Whatever position has for a value, you are subtracting i from it, this will and must lead to a value below NULL... That's why you are out of range.
EDIT: the debugger would have shown you...
Dominik Egert:
yep, thats it. thank you very much
Whatever position has for a value, you are subtracting i from it, this will and must lead to a value below NULL... That's why you are out of range.
EDIT: the debugger would have shown you...
For the beginners it's very common problem. If you understand it's very easy to solve. Suppose an array size is 10 i.e. array[10] that it's index start from 0 to 9. Somehow inside code if there something happened that index become less than 0 or more than 9 then this array out of range happen.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello guys, I'm new with MQL5 and I am trying to create a indicator which calculates the standard deviation from a vector of new calculated prices of the diference between close and opening from each candle.
I have successfully created the moving average with no problem but when I use MA values to calculate the STD there is no error running the code, but there is a error of array out of range in the expert tab.
can anyone just point what is wrong with my code?