NinjaScript > Language Reference > Indicator Methods >

n Bars Down

Print this Topic Previous pageReturn to chapter overviewNext page

Description

Checks for n number of consecutive lower closes. Returns a value of 1 when the condition is true or 0 when false.

 

 

Syntax

NBarsDown(int barCount, bool BarDown, bool lowerHigh, bool lowerLow)
NBarsDown(IDataSeries input, int barCount, bool BarDown, bool lowerHigh, bool lowerLow)

 

Returns default value
NBarsDown(int barCount, bool BarDown, bool lowerHigh, bool lowerLow)[int barsAgo]
NBarsDown(IDataSeries input, bool barCount, int BarDown, bool lowerHigh, bool lowerLow)[int barsAgo]

 

 

Return Value

double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.

 

 

Parameters

barCount

The number of required consecutive lower closes

BarDown

Each bar's open must be less than the close; true or false

input

Indicator source data (?)

lowestHigh

Consecutive lower highs required; true or false

lowestLow

Consecutive lower lows required; true or false

 

 

Examples

// Checks if we have 3 consecutive lower closes
double value = NBarsDown(3, true, true, true)[0];

 

if (value == 1)
   Print("We have three consecutive lower closes);

 

 

Source Code

You can view this indicator method source code by selecting the menu Tools > Edit NinjaScript > Indicator within the NinjaTrader Control Center window.