you need to add "raw' to the indicator datas:
and change "indicator_buffers 2"
SetIndexBuffer( 1,RAW,INDICATOR_CALCULATIONS);
I extracted it from a larger piece of code. This was a modification problem, sorry.
The out-of-range array problem is still present.
The out-of-range array problem is still present.
Crunch007: The out-of-range array problem is still present.
- Of course, it is. Raw is an array with no size. Make it a buffer as Jean said.
-
int limit=bars-2; pos=limit; while(pos>=0) { MA=iMAOnArrayMQL4(Raw, 0, Length, 0, MODE_SMA, pos); // accesses pos+Length-1 = Bars+Length-3
Then fix your second loop so you don't look back more than what data you have.
How to do your lookbacks correctly.
I will give it a try. Thanks for the feedback.

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
Hi,
I need assistance with an MA calculation. I want to use iMA with a custom applied price.
Is there an easy way to calculate iMA based on the difference between Open and Close?
example:
iMA(_Symbol,_Period,21,0,MODE_SMA,Close-Open);
I tried to convert my MQL4 code. But keep getting Array out of range error.
Thanks for any kind of help