> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# SessionIterator

## Definition

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

## Property Value

A [SessionIterator](/developer/desktop-sdk/references/common/sessioniterator) object which is used to calculate trading day/session information.

## Syntax

`SessionIterator`

## Examples

```csharp
protected override void OnDataPoint(Bars bars, double open, double high, double low, double close, DateTime time, long volume, bool isBar, double bid, double ask)
{
   // build a session iterator from the bars object being updated
   if (SessionIterator == null)
     SessionIterator = new SessionIterator(bars);

   // check if we are in a new trading session based on the trading hours selected by the user
   bool isNewSession = SessionIterator.IsNewSession(time, isBar);

   // calculate the new trading day
   if (isNewSession)
     SessionIterator.CalculateTradingDay(time, isBar);

   Print(SessionIterator.ActualTradingDayExchange);
}
```