I am using MC.NET and would like some information on what the easiest way is to determine if the current bar occurs 10 minutes after the regular session start and 30 minutes before the end of the regular session.
The reason is, if the signal is generated outside of regular hours I wish my strategy to generate an order for fewer contracts and have a larger stop.
However, I've noticed that the historic start/end times are a bit unusual (maybe its a data issue?). For example, for a continuous ES contract created as a Custom Futures symbol from a CQG datafeed, I see that for some reason Friday 22 March 2013 has a session start time of 15:30 and end-time of 08:00 yet the bar times are well after the end-time.int tradingDay = Math.Max( 0, (int)Bars.TimeValue.DayOfWeek - 1);
TimeSpan morning = new TimeSpan(11,0,0);
SessionObject session = Bars.Sessions[tradingDay];
TimeSpan enterTradesAfter = session.StartTime.Add(new TimeSpan(0,10,0));
TimeSpan enterTradesBefore = session.EndTime.Subtract(new TimeSpan(0,30,0));
//Bars.Request.SessionName
if ( Bars.TimeValue.DayOfWeek != DayOfWeek.Sunday // No trade in Sunday overnight session
&& session.StartTime.CompareTo(morning) < 0 // Start time must be before 11am
&& Bars.TimeValue.TimeOfDay.CompareTo(enterTradesAfter) > 0
&& enterTradesBefore.CompareTo(Bars.TimeValue.TimeOfDay) > 0
) {
// We're in regular trading hours?
}