Times
Previous Topic  Next Topic 

Definition

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


Property Value

An array of TimeSeries objects.


Syntax
Times[int barSeriesIndex][int barsAgo]


Property Of

Custom Strategy


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 time to the 5-minute bar's time
    if (Times[0][0].Ticks > Times[1][0].Ticks)
        Print("The current bar's time is greater");
}