NinjaScript > Language Reference > Data >

Opens

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Holds an array of DataSeries objects holding historical bar open prices. A DataSeries object is added to this array when calling the Add() method in a Custom Strategy. Its purpose is to provide access to the open prices of all Bars objects in a multi-instrument or multi-time frame strategy.

 

Property Value

An array of DataSeries objects.

 

Syntax
Opens[int barSeriesIndex][int barsAgo]

 

 

Examples

protected override void Initialize()
{
    // Adds a 5-minute Bars object to the strategy and is automatically assigned
    // a Bars object index of 1 since the primary data the strategy is run against
    // set by the UI takes the index of 0.
    Add(Instrument, PeriodType.Minute, 5);
}
 
protected override void OnBarUpdate()
{
    // Compares the primary bar's open price to the 5-minute bar's open price
    if (Opens[0][0] > Opens[1][0])
         Print("The current bar's open price is greater");
}