EMA on MACD, how?

 

Hello,


I'm trying to calculate the EMA of the MACD histogram. But the return value seems incorrect.

Is there any mistake in my codes? Below I'm trying to get EMA 21 of the default MACD histogram.


double mcd[100];
int EMA_MACD=21;
    
for(int d=0;d<=100;d++)
 {
   mcd[d]=iMACD(Symbol(),0,12,26,9,PRICE_CLOSE,MODE_MAIN,d);
 }
 
double emacd1=iMAOnArray(mcd,EMA_MACD,EMA_MACD,0,MODE_EMA,1);
 
double emacd2=iMAOnArray(mcd,EMA_MACD,EMA_MACD,0,MODE_EMA,2);


Thank you,

Ardi

 
 

Hi Phy,


You're the man!!


Thanks

Reason: