How to find out the iRSI in MQL5 for current tick?

 

Dear all,

I am complete new to Expert advisor programming. Hope you could shed some light on.

I have written following code in on_tick method:

       double currentSymbolRSI = iRSI(NULL,0,14,PRICE_CLOSE); //the RSI of previous bar

   if(currentSymbolRSI>40)

      Alert("Bigger than 70");

   else if(currentSymbolRSI<30)

      Alert("Less than 30"); 

 

but the point is currentSymbolRSI variable is always 10.0.

While the RSI chart is 49.5.

What am I doing wrong? 

 

You use MQL4, not MQL5. and you forgot to use the last input for iRSI, the code should be :

  double currentSymbolRSI = iRSI(NULL,0,14,PRICE_CLOSE,0); //the RSI of previous bar

   if(currentSymbolRSI>40)

      Alert("Bigger than 70");

   else if(currentSymbolRSI<30)

      Alert("Less than 30"); 
Reason: