Please I am working on MQL5 and I see Array out of range.
I have tried +1 but it still does not work. What else can I change to make it work?
for(int i = limit-1; i >= 0; i--)
if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
//Indicator Buffer 1
if(MA[-3+i] > MA2[i]
&& MA[-3+i+1] < MA2[i+1] //Moving Average crosses above Moving Average
&& MA2[i] > MA3[i] //Moving Average > Moving Average
Because your i ranges from 0 to limit-1, you end up accessing MA[-3], MA[-2] and MA[-1] - all of which will give you Array out of range error.
You'll also have to make sure that your 5000 and total-50 are less than or equal to limit (anyway, try to avoid hard-coding numbers other than the common -1.).
Thanks for the pointers.
Error now resolved.