<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > SessionIterator >


Previous page Return to chapter overview Next page


Obtains the date of a trading session defined by the exchange.



1.In order to obtain historical ActualTradingDayExchange information, you must call GetNextSession() from a stored SessionIterator object.

2.The calculated value may differ from the current date as some trading sessions will begin before the actual calender date changes. For example, the "CME US Index Futures ETH" actual session started on 3/30/2015 at 5:00PM Central Time, however the actual exchange trading day would be considered 3/31/2015 12:00:00AM



Property Value

A DateTime structure that represents the trading day.







SessionIterator sessionIterator;
protected override void OnStateChange()
  if (State == State.Historical)
    sessionIterator = new SessionIterator(Bars);
protected override void OnBarUpdate()
  // on new bars session, find the next trading session
  if (Bars.IsFirstBarOfSession)
    // use the current bar time to calculate the next session
    sessionIterator.GetNextSession(Time[0], true);
    Print("The current exchange trading day is " + sessionIterator.ActualTradingDayExchange);