Get Moving Average Value on RSI

 

Hi, I am trying to get the moving average value of the RSI.

RSI - 14 length

MA - 20

I saw a lot of different examples on here but seem a bit complicated. I created the below code which seems to be working just fine to get the current value. Can anyone confirm if this is correct or why it is wrong please? Because i'm a bit confused with all the complicated examples.

double rsiValue;
  double totRSI;
  Alert("");
  for(int i=0;i<20;i++)
    {
     rsiValue = iRSI(Symbol(), PERIOD_CURRENT, 14, PRICE_CLOSE, i);
     totRSI = totRSI + rsiValue;
    }
  Alert(totRSI/20);
 
nixonmark:

Hi, I am trying to get the moving average value of the RSI.

RSI - 14 length

MA - 20

I saw a lot of different examples on here but seem a bit complicated. I created the below code which seems to be working just fine to get the current value. Can anyone confirm if this is correct or why it is wrong please? Because i'm a bit confused with all the complicated examples.

It is correct well done , but set the totRSI on top to 0.0 on the dexclaration  👍 👍