SessionIterator

View as Markdown

Definition

Provides trading session information to the bars type. Must be built using the bars object.

Property Value

A SessionIterator object which is used to calculate trading day/session information.

Syntax

SessionIterator

Examples

1protected override void OnDataPoint(Bars bars, double open, double high, double low, double close, DateTime time, long volume, bool isBar, double bid, double ask)
2{
3 // build a session iterator from the bars object being updated
4 if (SessionIterator == null)
5 SessionIterator = new SessionIterator(bars);
6
7 // check if we are in a new trading session based on the trading hours selected by the user
8 bool isNewSession = SessionIterator.IsNewSession(time, isBar);
9
10 // calculate the new trading day
11 if (isNewSession)
12 SessionIterator.CalculateTradingDay(time, isBar);
13
14 Print(SessionIterator.ActualTradingDayExchange);
15}