Calculating a moving average of an indicator in EA?

 

Hello,

How can I calculate moving average of an indicator in an Expert Advisor?

For example:

How can i calculate the 4-bar simple moving average of "rsi1":

double rsi1 = iRSI(NULL,0,14,PRICE_CLOSE,0);

Best regards,

 
forex123:
Hello,

How can I calculate moving average of an indicator in an Expert Advisor?

For example:

How can i calculate the 4-bar simple moving average of "rsi1":

double rsi1 = iRSI(NULL,0,14,PRICE_CLOSE,0);

Best regards,

double rsi[4];

for(int i=0; i<4; i++)

rsi=iRSI(NULL,0,14,PRICE_CLOSE,i);

return (iMAOnArray(rsi,0,4,0,MODE_SMA,0));