EMA OF EMA

 

Hi, I'm a beginner for mq4 programming.

I would like help in programming a function that is the average of an average.

Knowing the EMA, how to program the EMA1 = f (EMA).

ES.

EMA = (period 12, exponential, price close)

EMA1 = (period 5, exponential, EMA).

Thanks to those who can help me.

Luciano

 
  1. Perhaps you should read the manual.
    iMAOnArray
    Calculates the Moving Average indicator on data, stored in array, and returns its value.
              iMAOnArray - Technical Indicators - MQL4 Reference

  2. Or just computed it.
    #define EMA(P,C,L) ((P) + ((C)-(P))*2./(L+1))
    ⋮
    static double value=0, ema1=0, ema2=0;
    double Vp = value;    value = …;
    double ema1p = ema1;  ema1  = EMA(Vp, value, Length);
    double ema2p = ema2;  ema2  = EMA(ema1p, ema2p, Length);
    

 
Thank you very much for the indication you gave me.
Reason: