NinjaScript > Language Reference > Data >

BarsPeriod

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
The primary Bars object period type and interval.
 

NOTE: This property should NOT be accessed within the Initialize() method.

 

Property Value

A Period object.

 

Syntax

BarsPeriod.BasePeriodType

Only relevant for Kagi, LineBreak, and PointAndFigure Bars objects. Possible values:

 

PeriodType.Tick

PeriodType.Volume

PeriodType.Second

PeriodType.Range

PeriodType.Minute

PeriodType.Day

PeriodType.Week

PeriodType.Month

PeriodType.Year

PeriodType.Kagi

PeriodType.LineBreak

PeriodType.PointAndFigure

PeriodType.Renko

BarsPeriod.BasePeriodValue

Only relevant for Kagi, LineBreak, and PointAndFigure Bars objects. Returns an integer value representing the basePeriodTypeValue parameter

BarsPeriod.Id

Same possible values as BarsPeriod.BasePeriodType.

BarsPeriod.MarketDataType

Possible values:

 

MarketDataType.Ask

MarketDataType.Bid

MarketDataType.Last

BarsPeriod.PointAndFigurePriceType

Only relevant for PointAndFigure Bars objects. Possible values:

 
PointAndFigurePriceType.Close

PointAndFigurePriceType.HighsAndLows

BarsPeriod.ReversalType

Only relevant for Kagi Bars objects. Possible values:
 
ReversalType.Percent
ReversalType.Tick

BarsPeriod.Value

Returns an integer value representing the period parameter.

 - When using Kagi Bars objects this represents the "reversal" parameter

 - When using LineBreak Bars objects this represents the "lineBreakCount" parameter

 - When using PointAndFigure Bars objects this represents the "boxSize" parameter

 - When using Renko Bars objects this represents the "brickSize" parameter

BarsPeriod.Value2

Only relevant for PointAndFigure Bars objects. Returns an integer value representing the "reversal" parameter.

 

Examples

// Calculate only if there is a 100 tick chart or greater
protected override void OnBarUpdate()
{
    if (BarsPeriod.Id == PeriodType.Tick && BarsPeriod.Value >= 100)
    {
        // Indicator calculation logic here
    }
}