Sessions

View as Markdown

Definition

A collection of session definitions of the configured Trading Hours template.

Available Properties

ParameterDescription
BeginDayA DayOfWeek value representing the begin day
BeginTimeAn int value representing the begin time
EndDayA DayOfWeek value representing the end day
EndTimeAn int value representing the end time
TradingDayA DayOfWeek value representing the trading day this session belongs to

Syntax

Bars.TradingHours.Sessions[int idx]

Tip: Each index value will represent a new defined session for the Trading Hours template. For example, accessing Bars.TradingHours.Sessions[0] would provide you with information for the first trading session configured in the Trading Hours template:

  • Bars.TradingHours.Sessions[0].TradingDay = DayOfWeek.Monday,
  • Bars.TradingHours.Sessions[1].TradingDay = DayOfWeek.Tuesday,
  • Bars.TradingHours.Sessions[2].TradingDay = DayOfWeek.Wednesday, etc.

Examples

1// Print details for all sessions in the Trading Hours template
2for (int i = 0; i < TradingHours.Sessions.Count; i++)
3{
4 Print(String.Format("Session {0}: {1} at {2} to {3} at {4}", i, TradingHours.Sessions[i].BeginDay, TradingHours.Sessions[i].BeginTime,
5 TradingHours.Sessions[i].EndDay, TradingHours.Sessions[i].EndTime));
6}