n Bars Up
Previous Topic  Next Topic 

Definition

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 inputData, 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 inputData, int barCount, bool BarUp, bool higherHigh, bool higherLow)[int barsAgo]


Return Type
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

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

inputData

Indicator source data (?)


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 open up the indicator source code via the NinjaScript Editor.