I really do not understand what is happening with the for loop here in Ninjatrader.
I am writing the code in protected override void OnBarUpdate().
I have done the following:
int Period = 15;
if(CurrentBar < 0)
return;
for(int i = 0; i < 5; i++)
{ double l_high = MAX(High, Period)[i];
double l_low = MIN(Low, Period)[i];
}
I have repeated the same code by replacing 5 by Currentbar and this time I could have the values of l_high and l_low.
I have then replaced 5 by Period and the error message was on bar 15.
What is the problem when I have the number 5 or 15?
What is the secret here in Ninjatrader to overcome this problem? This problem is receurrent for me and I really do not know what to do.
I would really appreciate any help.

Comment