Identifying symbols related to market sessions

 

Good day


Is there a way to identify if a symbol is related to a particular market session? In other words I want my EA to only trade EURUSD during the NY or Europe sessions. The only thing I could think of was to manually program a static array that relates all symbol pairs to their related sessions and use this to control my trades.

I tried playing around with the SymbolInfoSessionTrade function but I couldn't figure out how it is supposed to work.


Any advise would be appreciated.

 
Hi Louis

I don't know if this might help, however I managed to get the 'SymbolInfoSessionTrade()' function to actually be useful. 

The function simply checks if the current symbol can be traded on the time you supply (if it can returns true). You might be able to use this to check against certain times you wish to trade. 

    bool      isTradingDay(datetime time)
{
  MqlDateTime struct_time;         // create MqlDateTime variable
  TimeToStruct(time, struct_time); // convert 'time' variable to a structure 
  datetime fromTime;               // dont need to be initialised
  datetime toTime;                 // dont need to be initialised
  return SymbolInfoSessionTrade(_Symbol, (ENUM_DAY_OF_WEEK)struct_time.day_of_week, 0, fromTime, toTime);
}      // NOTE: 0 session is the FIRST session for that day (i.e. if 0 = NO TRADING DAY) 

With regards identifying symbols related to particular market sessions, my understanding is surely you can trade all the currencies against all market sessions ?!? ( or am i wrong)  

Good luck