What do you mean?

"MA20 of ATR10" is calculated as follows.

MA20[1] = (ATR[1] + ATR[2] + ATR[3]...... + ATR[20]) / 20;

I checked it by programming, and the results are the same.

(Look at the "Comment". MA1 is the result of "iMAOnArray", and MA2 is the result of the above calculation.)

**Files:**

Test_Indicator.mq4 7 kb

I'm new to MQL. I'm trying to get the SMA of the ATR value.

Is this supposed to work?

int lookback = 1000;

for(int i=lookback-1;i>=0;i--) atr[i] = iATR(NULL, 0, 10, i);

for(int a=lookback-1;a>=0;a--) ma[a]=iMAOnArray(atr,lookback,20,0,MODE_SMA,a);

Print("atr= "+DoubleToStr(atr[1], _Digits)+" ma= "+DoubleToStr(ma[1], _Digits));

atr[1] is correct... ma[1] is WRONG!

Any assistance would be greatly appreciated. Thanks in advance.

Robert