Error Message:
Indicator 'aBDS': Error on calling 'OnRender' method on bar 0: 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.
BarsRequiredToPlot = 5;
Bars2Avg = 5;
if (BarsRequiredToPlot < 5 || CurrentBar < Bars2Avg)
return;
if (CurrentBar > Bars2Avg && CurrentBar > BarsRequiredToPlot && ToTime(Time[1]) > ToTime(9, 30, 00) && ToTime(Time[0]) <= ToTime(16, 00, 00) && GetCurrentBid() > 0 && GetCurrentAsk() > 0)
{
// My Indicator logic
}
Max bars back used is 4
What am I missing?
Comment