I'd like some clarification please on a loop forward care I end up with the all-too-familiar error "Error on calling 'OnBarUpdate' method on bar 16: You are accessing an index with a value that is invalid since it is out-of-range. accessing a series [barsAgo] with a value."
Even if I understand it, I don't understand why it's triggered in my specific case, since I've already looped over all the bars and I'm waiting to get to the "CurrentBar" before proceeding.
I'm trying to test the value of the indicator I've calculated and what I'm doing seems logical, but obviously it's not...
I searched but couldn't find anything specific to loops that run in this direction and the end...
Any advice would be appreciated...
Thank you in advance.
if (CurrentBar == 0) { for ( index = Count; index > 0; index--) { Print(index.ToString()); if (MyIndic[index]>0) { Print(index.ToString()+" "+ MyIndic[index].ToString()); } } return; }
Comment