NinjaScript > Language Reference > Indicator Methods >

n Bars Up

Print this Topic Previous pageReturn to chapter overviewNext page

Description

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

 

 

Syntax

NBarsUp(int barCount, bool BarUp, bool higherHigh, bool higherLow)
NBarsUp(IDataSeries input, int barCount, bool BarUp, bool higherHigh, bool higherLow)

 

Returns default value
NBarsUp(int barCount, int barCount, bool BarUp, bool higherHigh, bool higherLow)[int barsAgo]
NBarsUp(IDataSeries input, int barCount, bool BarUp, bool higherHigh, bool higherLow)[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 higher closes

BarUp

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

higherHigh

Consecutive higher highs required; true or false

higherLow

Consecutive higher lows required; true or false

input

Indicator source data (?)

period

Number of bars used in the calculation

 

 

Examples

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

 

if (value == 1)
   Print("We have three consecutive higher 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.