I have an indicator with 60min primary data series and Daily as secondary data series. I have CurrentBars[1] <= BarsRequiredToPlot and BarsRequiredToPlot = 201
I have added SMA100 = SMA(BarsArray[1], 100); for the daily 100 sma
When I Print("100sma " + SMA100[80]); I get an Error on calling 'OnBarUpdate' method on bar 4904: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
If I am requiring 201 daily bars, and asking for the 100 period SMA price 80 daily bars ago shouldn't I have enough bars? This error seems to go away if I ask it to Print("100sma " + SMA100[60]);
Any help will be appreciated.
Thanks,
Ryan

Comment