ActualSessionBegin

View as Markdown

Definition

Obtains the sessions start date and start time converted to the user’s configured Time Zone.

In order to obtain historical ActualSessionBegin information, you must call GetNextSession from a stored SessionIterator object.

Property Value

A DateTime structure that represents beginning of a trading session.

Syntax

SessionIterator.ActualSessionBegin

Example

1SessionIterator sessionIterator;
2
3protected override void OnStateChange()
4{
5 if (State == State.Historical)
6 {
7 sessionIterator = new SessionIterator(Bars);
8 }
9}
10
11protected override void OnBarUpdate()
12{
13 // on new bars session, find the next trading session
14 if (Bars.IsFirstBarOfSession)
15 {
16 // use the current bar time to calculate the next session
17 sessionIterator.GetNextSession(Time[0], true);
18
19 Print("The current session start time is " + sessionIterator.ActualSessionBegin);
20 }
21}