Getting the Moving Average value from the RSI for my EA

 

I am trying to get the moving average value from the rsi, similar to how it is displayed in tradview indicator. I managed to write the below code but it is not working as expected obviously :D Would love any help. I want to get MA 20 (PRICE_CLOSE) on RSI of 14

Appreciate any help! Thank you!

int i,j;
   int signal=20;
   double RSIBuffer[];
   double MAofRSIBuffer[];
   ArrayResize(RSIBuffer,signal*2);
   ArrayResize(MAofRSIBuffer,signal+2);
   for(i=0 ; i<signal*2 ; i++)
    {
      RSIBuffer[i] = iRSI(NULL,0,14,PRICE_CLOSE,i);

    }
    
   ArraySetAsSeries(RSIBuffer,true);


   for(i=0; i <signal+2; i++)
      {
        MAofRSIBuffer[i]=iMAOnArray(RSIBuffer,0,signal,0,MODE_SMA,i);
        Print ("IMAOnArray for ",i," = ",iMAOnArray(RSIBuffer,0,signal,0,MODE_SMA,i));
      }
   Alert ("rsi = ",RSIBuffer[1]);   
   Alert ("MA of RSI for bar= ", 1," = ",MAofRSIBuffer[1]);
  
  }
 

Here you have  list with all functions and a brief explanation: https://www.mql5.com/en/docs/function_indices

If yxou e.g. search for RSI you'll find this: https://www.mql5.com/en/docs/indicators/irsi

which includes an example from where you can copy, paste and amend what you need.

Documentation on MQL5: List of MQL5 Functions
Documentation on MQL5: List of MQL5 Functions
  • www.mql5.com
List of MQL5 Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Set your array to as-series before filling it.
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.