I had a developed an Indicator to work with 5 minute bars on a 2 minute chart. It was working all right but since yesterday it is giving me error. I can't think of any valid reason for it to stop working. I modified the indicator to very minimal code below to figure out why I am getting the error, but even the simple code below is not working. Totally lost as to what is going on. Here is the minimal code which is giving error:
protected override void Initialize()
{
Overlay = true;
Add(PeriodType.Minute, 5);
}
protected override void OnBarUpdate()
{
if(BarsInProgress > 0) //no need to process other time frames here
return;
if(CurrentBar > 500)
{
double emaFast = EMA(Closes[1],8)[0];
//since its not working, just trying to print the values
Print("CurrentBar: "+CurrentBar+" 5min-emaFast: "+emaFast);
}
I am getting the error:
Error on calling 'OnBarUpdate' method for indicator 'AshIndicator1' on bar 501: You are accessing an index with a value that is invalid since its out of range.
Please advise....
Comment