Array out of Range in iBarshift..

 
Hi, I am getting critical error ''Array out of range" in iBarshift function. I am trying to create an EA based on breakout but iBarshift function throwing error at Time[pos] field. Please check the code..regards.

limit = Bars - 1 - counted_bars;
   
   // Iteration
   for(int pos = limit; pos >= start; pos--)
   {
    int dshift = iBarShift(Symbol(),PERIOD_H1, Time[pos], false); // Getting Out of range error at Time[pos] 


 
You don't show how you set the values of counted_bars or start. Can't help if you don't give the information. Try adding a print statement for some debugging.
 
The out of range means the number you are trying to index is not found. recheck the value of 'limit'
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
Reason: