Download MetaTrader 5

SymbolInfoSessionQuote() fails for ,SATURDAY

To add comments, please log in or register
David Ewing
28
David Ewing  

When the following is called on a Saturday (GMT) , status returns false. Why? 

static bool logfile::isOpenMarket(bool&status)

  {

   bool deebug=DEEBUG,title=TITLE,analysis=ANALYSIS;

   bool result;

   MqlDateTime mqldtnow;

   datetime dtstart,dtend,dtnow=TimeGMT();    /* assume server is on GMT */

   TimeToStruct(dtnow,mqldtnow);

   dtnow  = TimeHour(dtnow)*60 + TimeMinute(dtnow);

   status = SymbolInfoSessionQuote(_Symbol,mqldtnow.day_of_week,0,dtstart,dtend);

   TestError();

   result=dtstart<dtnow && dtnow<dtend;

   return(result); 

}

//+------------------------------------------------------------------+

  }

//+------------------------------------------------------------------+

Alain Verleyen
Moderator
33593
Alain Verleyen  
David Ewing:

When the following is called on a Saturday (GMT) , status returns false. Why? 

static bool logfile::isOpenMarket(bool&status)

  {

   bool deebug=DEEBUG,title=TITLE,analysis=ANALYSIS;

   bool result;

   MqlDateTime mqldtnow;

   datetime dtstart,dtend,dtnow=TimeGMT();    /* assume server is on GMT */

   TimeToStruct(dtnow,mqldtnow);

   dtnow  = TimeHour(dtnow)*60 + TimeMinute(dtnow);

   status = SymbolInfoSessionQuote(_Symbol,mqldtnow.day_of_week,0,dtstart,dtend);

   TestError();

   result=dtstart<dtnow && dtnow<dtend;

   return(result); 

}

//+------------------------------------------------------------------+

  }

//+------------------------------------------------------------------+

Usually there is no trading session on Saturday.
To add comments, please log in or register