Hi, will MC.NET recognize that I want the m_avg.Value calculated on the 2nd data series in the following or is there something else I need to add?
if (BarsOfData(2).Close[0] < m_avg.Value) {
Many thanks
syntax question [SOLVED]
Re: syntax question
Ok it's definitely wrong, I'm getting a null reference exception: object reference not set to an instance of an object. So any help getting m_avg.Value to reference the 2nd data series appreciated. Thanks a lot.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: syntax question
Can you post more information about what `m_avg.Value` is? I suppose it's a variable series (`VariableSeries<T>`) given its `Value` property, but a variable series doesn't perform calculations itself (regardless of the number of data series you use).
All a variable series does is storing a value. So if that's what you're using in the code, then no, MultiCharts .NET cannot recognise that you want `m_avg.Value` computed on the second data series. Or is `m_avg` perhaps an instance of a moving average function?
All a variable series does is storing a value. So if that's what you're using in the code, then no, MultiCharts .NET cannot recognise that you want `m_avg.Value` computed on the second data series. Or is `m_avg` perhaps an instance of a moving average function?
Re: syntax question [SOLVED]
Thanks for the reply Josh. I've just scripted the following in StartCalc(): m_averagefc1.price = BarsOfData(2).Close; so now m_avg.Value references the right data series. Woke up before 5 with the answer ringing in my head
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: syntax question
That's indeed the correct approach to calculate a function on a different data series. What a good way to wake up! (Might be a bit earlier though ). Glad you got it fixed.I've just scripted the following in StartCalc(): m_averagefc1.price = BarsOfData(2).Close; so now m_avg.Value references the right data series. Woke up before 5 with the answer ringing in my head