Download MetaTrader 5

SymbolInfoSessionQuote() fails for ,SATURDAY

To add comments, please log in or register
Interested in the Market activity? Come and track!
David Ewing
28
David Ewing 2015.09.26 04:48 

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
30736
Alain Verleyen 2015.10.01 21:29  
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