Indicator 'EMA': Error on calling 'OnBarUpdate' method on bar 16218: 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.
Strategy 'Algo': Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object.
I have
else if (State == State.DataLoaded)
{
ClearOutputWindow(); //Clears Output window every time strategy is enabled
fastEMA = EMA(FastEMAPeriod);
slowEMA = EMA(SlowEMAPeriod);
baseEMA = EMA(BaseEMAPeriod);
}
region Bars in progress 2
else if (BarsInProgress == 2 && IsFirstTickOfBar)
{
if (CurrentBars[0] < 20 || CurrentBars[2] < 6 )
return;
fastHTFEMA = EMA(BarsArray[2], 8);
slowHTFEMA = EMA(BarsArray[2], 34);
baseHTFEMA = EMA(BarsArray[2], 89);
base200HTFEMA = EMA(BarsArray[2], 200);

Comment