NinjaScript > Language Reference > Indicator >

BarsRequired

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
The number of bars on a chart required before the indicator plots. This is NOT the same as a minimum number of bars required to calculate the indicator values.

 

Property Value

An int value that represents the minimum number of bars required.

 

Syntax

BarsRequired

 

 

Examples

// Initialize method of a custom indicator
protected override void Initialize()
{
    Add(new Plot(Color.Orange, "SMA"));
    BarsRequired = 10; // Do not plot until the 11th bar on the chart
}

 

Tips

1.When working with a multi-series indicator, real-time bar update events for a particular Bars object are only received when that Bars object has satisfied the BarsRequired requirement. To ensure this requirement is met, please use the CurrentBars array.