NthHighest (Function)
The NthHighest function will return the highest, second highest, third highest (and so on) price over a specified number of bars.
Syntax
NthHighest(N, Price, Length)
Returns (Double)
A numeric value containing the āNāth highest occurrence of Price over the last Length bars.
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 Highest function, NthHighest 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 NthHighest 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 value of the 2nd highest Close that occurred during the past 30 bars.
Value1 = NthHighest(2, Close, 30);