NinjaScript > Language Reference > Data >

Historical

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Indicates if the NinjaScript object is running on historical data. With a strategy, when running a backtest, this property will always return true. When running a live strategy, this property will be true until the strategy starts processing real-time data. The property can be of value for many different applications.

 

1.Filtering out historical data for real-time strategies that does not require any historical data to initialize.

 

Property Value

This property returns true if the NinjaScript is running on historical data; otherwise, false.

 

Syntax

Historical

 

 

Examples

protected override void OnBarUpdate()
{
    // Only run on real-time data
    if (Historical)
         return;
}

 

 

Tips

1.When using this property in a strategy that is running with "Wait until flat before executing live", the property will return "true" until the strategy reaches a flat state and switches to live executions.