I must be doing something stupid, but have not been able to find what it is...
I have a fully loaded chart with 252 bars (daily interval).
When I am trying to get previous day's ATR(5), the following line is throwing an out of range error:
double ATR_5 = ATR(5)[1];
The error in the output window is:
Error on calling 'OnRender' method on bar 251: 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.
The weird thing is that getting today's value works (i.e. double ATR_5 = ATR(5)[0]; )
What am I missing?
Thanks a lot!
Libor
Comment