MT5 Quote and Trade sessions
Code Snippet
- public bool IsQuoteSession(MT5API qc, string symbol)
- {
- var tradeSessionsForWeek = qc.Symbols.Sessions[symbol].Quotes;
- var todaySessions = tradeSessionsForWeek[(int)qc.ServerTime.DayOfWeek];
- foreach (var item in todaySessions)
- if (qc.ServerTime.Minute > item.StartTime && qc.ServerTime.Minute < item.EndTime)
- return true;
- return false;
- }
- public bool IsTradeSession(MT5API qc, string symbol)
- {
- var tradeSessionsForWeek = qc.Symbols.Sessions[symbol].Trades;
- var todaySessions = tradeSessionsForWeek[(int)qc.ServerTime.DayOfWeek];
- foreach (var item in todaySessions)
- if (qc.ServerTime.Minute > item.StartTime && qc.ServerTime.Minute < item.EndTime)
- return true;
- return false;
- }