How to use iRSI function to get the value of RSI on the last bar in a chart

To add comments, please log in or register
MT5.2014
55
MT5.2014  

Hi guys,

I used iRSI function  in following format

int  iRSI(
   string              symbol,            // symbol name
   ENUM_TIMEFRAMES     period,            // period
   int                 ma_period,         // averaging period
   ENUM_APPLIED_PRICE  applied_price      // type of price or handle
   );


in an indicator to get the value of RSI on the last bar of a chart, but it did not work, does it need extra code or I am doing something wrong.

Thanks 

Alain Verleyen
36134
Alain Verleyen  
What didn't work ? Please show your code if you need coding help.
MT5.2014
55
MT5.2014  
Alain Verleyen:
What didn't work ? Please show your code if you need coding help.
It does not return the value of RSI, it returns 10 even when I changed the symbol or timeframe
MT5.2014
55
MT5.2014  
MT5.2014:
It does not return the value of RSI, it returns 10 even when I changed the symbol or timeframe
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
double iRSIBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])

      
{
         CopyBuffer(iRSI(_Symbol,PERIOD_H4,14,PRICE_CLOSE),0,0,1,iRSIBuffer);
         double irsiv = iRSIBuffer[0];
         Comment (irsiv);

         if(irsiv<30.00)
         {
            Alert("Buy");
         }         
      
   return(rates_total);
}
it shows the comment (irsiv value) correctly, but it does not show the alert correctly (the if clause does not work)
eestrada
5
eestrada  
MT5.2014:
it shows the comment (irsiv value) correctly, but it does not show the alert correctly (the if clause does not work)

Hi dude, I have the same issue, could you make it work?

whroeder1
17940
whroeder1  
eestrada: Hi dude, I have the same issue, could you make it work?

What part of the posted code (MT5.2014 2015.06.14 12:09 ) was unclear?

To add comments, please log in or register