NthHighestBar (Function)

image\trumpet2.gif Disclaimer

The NthHighestBar function will return the number of bars ago the highest, second highest, third highest (and so on) price occurred.

Syntax

NthHighestBar(N, Price, Length)

Returns (Integer)

A numeric value containing the number of bars ago the ’N’highest occurrence of Price occurred.

Parameters

Name

Type

Description

N

Numeric

The occurrence to return. 1 = highest, 2 = 2nd highest, and so on.

Price

Numeric

Specifies which bar value (price, function, or formula) to compare for the highest occurrence.

Length

Numeric

The number of trailing bars to consider.

Remarks

Just like the HighestBar function, NthHighestBar has the inputs Price and Length. It also has the input N that allows you to specify if it is the second, third, and so on highest value desired.

  The Length input in the NthHighestBar function can only be replaced with a value equal to or less than 100. The value for N should not be greater than the value for the input Length..

Example

Returns the number of bars ago that the 2nd  highest Close occurred during the past 25 bars.

Value1 = NthHighestBar(2, Close, 25);