I am coding a strategy that uses a crossover of two T3 moving averages and the strategy stops and throws the error message in the output window: "Error: Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object."
At the same time, the Log shows: "Indicator EMA: Error on calling OnBarUpdate method on bar xxxx: You are trying to access an index with a value that is invalid since it is out of range. I E accessing a series [barsAgo] with an value of 5, when there are only 4 bars on the chart". This error usually comes up twice for the EMA and once for the T3, with the same message.
The next error in the log is an identical message with the one in the strategy output window, as above.
When I run the strategy in Debug mode, Visual Studio stops first at the EMA error, then when I click Continue, it stops at the T3 error, then if I click Continue again, it runs normal to the end of the test period. Needles to say, I don't really understand what the messages in the Visual Studio prompts mean
I'm using Market Replay Data with Playback connection, but it does the same with the live market data connection.
So far, it seems that this is happening only when I include in the triggering logic the condition,
(CrossAbove(T31b2, T32b2, 1)
This is my T3 code
public class ATM2 : Strategy { private T3 T31b0; private T3 T32b0; private T3 T31b2; private T3 T32b2; [B]....[/B] else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Tick, 1); AddDataSeries(Data.BarsPeriodType.Minute, 5); } else if (State == State.DataLoaded) { [B]....[/B] T31b2 = T3(Closes[2], 5, 3, 0.7); T32b2 = T3(Closes[2], 8, 3, 0.7); T31b0 = T3(Closes[0], 5, 3, 0.7); T32b0 = T3(Closes[0], 8, 3, 0.7); T31b0.Plots[0].Brush = Brushes.Transparent; T32b0.Plots[0].Brush = Brushes.Transparent; AddChartIndicator(T31b0); AddChartIndicator(T32b0);
Comment