> 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.

# Bars

## Definition

Represents the data returned from the historical data repository. The Bars object contain several methods and properties for working with bar data.

The Bars object and its member should NOT be accessed within the [OnStateChange()](/developer/desktop-sdk/references/common/onstatechange) method before the State has reached **State.DataLoaded**

## Additional Access Information

Members within the Bars class can be accessed without a null reference check in the OnBarUpdate() event handler. When the OnBarUpdate() event is triggered, there will always be a Bar object which holds the method or property. Should you wish to access these members elsewhere, check for null reference first. e.g. if (Bars != null)

## Methods and Properties

| [BarsSinceNewTradingDay](/developer/desktop-sdk/references/common/bars/barssincenewtradingday)           | Number of bars that have elapsed since the start of the trading day                                                              |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [GetAsk()](/developer/desktop-sdk/references/common/bars/getask)                                         | Returns the Ask price                                                                                                            |
| [GetBar()](/developer/desktop-sdk/references/common/bars/getbar)                                         | Returns the bar index based on time                                                                                              |
| [GetBid()](/developer/desktop-sdk/references/common/bars/getbid)                                         | Returns the Bid price                                                                                                            |
| [GetClose()](/developer/desktop-sdk/references/common/bars/getclose)                                     | Returns the closing price                                                                                                        |
| [GetDayBar()](/developer/desktop-sdk/references/common/bars/getdaybar)                                   | Returns a Bar object that represents a trading day whose properties for open, high, low, close, time and volume can be accessed. |
| [GetHigh()](/developer/desktop-sdk/references/common/bars/gethigh)                                       | Returns the High price                                                                                                           |
| [GetLow()](/developer/desktop-sdk/references/common/bars/getlow)                                         | Returns the Low price                                                                                                            |
| [GetOpen()](/developer/desktop-sdk/references/common/bars/getopen)                                       | Returns the opening price                                                                                                        |
| [GetTime()](/developer/desktop-sdk/references/common/bars/gettime)                                       | Returns the time                                                                                                                 |
| [GetVolume()](/developer/desktop-sdk/references/common/bars/getvolume)                                   | Returns the volume                                                                                                               |
| [IsFirstBarOfSession](/developer/desktop-sdk/references/common/bars/isfirstbarofsession)                 | Returns true if the bar is the first bar of a session                                                                            |
| [IsFirstBarOfSessionByIndex()](/developer/desktop-sdk/references/common/bars/isfirstbarofsessionbyindex) | Returns true if the bar is the first bar of a session                                                                            |
| [IsLastBarOfSession](/developer/desktop-sdk/references/common/bars/islastbarofsession)                   | Returns true if the bar is the last bar of a session                                                                             |
| [IsResetOnNewTradingDay](/developer/desktop-sdk/references/common/bars/isresetonnewtradingday)           | Returns true if the chart bars should reset on a new trading day                                                                 |
| [IsTickReplay](/developer/desktop-sdk/references/common/bars/istickreplay)                               | Returns true if the bars are using tick replay                                                                                   |
| [PercentComplete](/developer/desktop-sdk/references/common/bars/percentcomplete)                         | Value indicating the completion percent of a bar                                                                                 |
| [TickCount](/developer/desktop-sdk/references/common/bars/tickcount)                                     | Total number of ticks of the current bar                                                                                         |
| [ToChartString()](/developer/desktop-sdk/references/common/bars/tochartstring)                           | Returns the bars series as a string formatted as the series would be displayed in the user interface                             |