line 117
int limit = prev_calculated==0?rates_total-(MathMax(InpRSIPeriod,InpStockKPeriod)+1):rates_total-prev_calculated+1;
After this line, shift+length exceeds rates_total, resulting in an array out-of-range error.
You can find the cause by tracing the data using the debugger.

Debugging MQL5 Programs
- www.mql5.com
This article is intended primarily for the programmers who have already learned the language but have not fully mastered the program development yet. It reveals some debugging techniques and presents a combined experience of the author and many other programmers.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The exit error is " array out of range in 'Stoch RSI.mq5' (162,29)"
The error occurs on the line "if(Result==0 || (high[i]>Result && high[i]!=EMPTY_VALUE))"
Now I do realize that the indicator will work fine if I just change the values to normal but you see my strategy requires two certain periods to be effective, and thus I need the indicator to work when the period of the stochastics is higher than the period value of the RSI in my EA.
I would very much appreciate if you could help me with this problem