Bars

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common >

Bars

Previous page Return to chapter overview Next page

Definition

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

 

Warning: The Bars object and its member should NOT be accessed within the 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

Number of bars that have elapsed since the start of the trading day

GetAsk()

Returns the Ask price

GetBar()

Returns the bar index based on time

GetBid()

Returns the Bid price

GetClose()

Returns the closing price

GetDayBar()

Returns a Bar object that represents a trading day whose properties for open, high, low, close, time and volume can be accessed.

GetHigh()

Returns the High price

GetLow()

Returns the Low price

GetOpen()

Returns the opening price

GetTime()

Returns the time

GetVolume()

Returns the volume

IsFirstBarOfSession

Returns true if the bar is the first bar of a session

IsFirstBarOfSessionByIndex()

Returns true if the bar is the first bar of a session

IsLastBarOfSession

Returns true if the bar is the last bar of a session

IsResetOnNewTradingDay

Returns true if the chart bars should reset on a new trading day

IsTickReplay

Returns true if the bars are using tick replay

PercentComplete

Value indicating the completion percent of a bar

TickCount

Total number of ticks of the current bar

ToChartString()

Returns the bars series as a string formatted as the series would be displayed in the user interface