Download MetaTrader 5
To add comments, please log in or register
Let your idle PCs do something useful. Join MQL5 Cloud Network!
John Skinner
120
John Skinner 2014.05.28 11:22 

Hi,

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

John

/
To add comments, please log in or register