I am facing a recurrent problem again. This issue occures in my case mostly when I use the loop.
This is the contect this time:
I set my period at 100.
protected override void OnBarUpdate()
{
if (CurrentBar < Period)
return;
List<double> myArray = new List<double> ();
for(int i = Period; i > 0; i--)
{
myArray.Add(High[i]);
}
for(int j = 0; j < myArray.Count; j++)
{
Print("***** Bar " + myArray[j] + " Values: *****");
}
}
The output prints me the error message " "You are accessing an index with a value that is invalid since it is out-of-range."
I changed the condition (filter to : if (CurrentBar < 0) return. The same error message appears.
Even by setting the period to 1000 I can not solve the problem.
What could be the reason of the failure?
Thanks

Comment