Download MetaTrader 5

iRSI returns zero for daily timeframe

To add comments, please log in or register
John Skinner
John Skinner  


I'm not sure if I have found a bug in MT4 build 646 but it is driving me nuts to try and get my code to work. Has anyone else had this issue?

When I use iRSI in a script running on a chart (example ZARJPY) and reference another symbol with the D1 time frame then zero is returned unless the chart for the symbol I am referencing is open.

The issue seems to only occurs for the D1 time frame

Below is the function code I am using

string rsi = GetRSI(symbolList[i], 1440);

string GetRSI(string symbol, int timeFrame)
   string returnVal="none";
   double RSI_Main = iRSI(symbol,timeFrame,8,PRICE_CLOSE,1);

   // Long position
   if (RSI_Main > 55)
      returnVal = "up";

   // Short position
   if (RSI_Main < 45)
      returnVal = "down";

   rsiText = DoubleToString(RSI_Main,2);
   return returnVal;


If anyone has any ideas how to solve the problem I would really appreciate some help.

Thanks in advance


To add comments, please log in or register