NthHighestArray (Function)

image\trumpet2.gif Disclaimer

The NthHighestArray function will return the highest, second highest, third highest, and so on array element, based on the input N.

Syntax

NthHighestArray(PriceArray, Size, N)

Returns (Double)

A numeric value containing the ’N’th highest occurrence of the specified array. If N is greater than the declared array size or the Size input, or it is less than zero, the function will return a -1.

Parameters

Name

Type

Description

PriceArray

Numeric Array

Specifies the name of a numeric array containing bar values to compare for highest extremes.

Size

Numeric

Sets the number of data elements (size) in the array to evaluate.

N

Numeric

Sets which value to search for (that is, 1 = highest 2 = 2nd highest, and so on).

Remarks

Just like the HighestArray function the NthHighestArray function is based on an array. In addition, it also has the input N. This is the input that specifies whether the first, second, third, and so on highest value desired.

The value for the Size input parameter should always be a whole number greater than 0 and is typically equal to the number of data elements in the array.

The NthHighestArray function only works with one-dimensional arrays.  All array-based referencing begins with array element 1.

Example

Assigns to Value2 the 2nd highest Close in the specified named array myArray with 20 elements.

Array: myArray[20](0);

{… add EL statements here to assign Close values to array elements... }

Value1 = NthHighestArray (myArray, 20, 2);

See Also

NthExtremesArray, NthLowestArray