Download MetaTrader 5

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

To add comments, please log in or register
Launch your trading signal and add account monitoring!
mosini
7
mosini 2016.05.16 07:34 

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? 

Biantoro Kunarto
14896
Biantoro Kunarto 2016.05.16 09:16  

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"); 
To add comments, please log in or register