PercentRank (Function)

image\trumpet2.gif Disclaimer

The PercentRank function calculates the percentile rank of a bar value in a data set.

Syntax

PercentRank(PriceToRank, Price, Length)

Returns (Integer)

The percentile rank of a value in a data set.  The function returns -1 if PriceToRank is outside the range of the data set or if there is a Length error.

Parameters

Name

Type

Description

PriceToRank

Numeric

Sets the value to be ranked within the Price data series.

Price

Numeric

Specifies which bar value (price, function, or formula) to be considered.

Length

Numeric

Sets the number of bars to be considered.

Remarks

This function can be used to evaluate the relative standing of a value within a data set, as specified by the Price and Length inputs. If PriceToRank < the lowest price in the data series, PriceToRank > the highest price in the data series or the Length <= 0 the function will return -1.

Example

Assigns to Value1 the percentage rank of the value 260 within the data set defined by the Closes of the last 21 bars:

Value1 = PercentRank(260, Close, 21);

Assigns to Value2 the percentage rank of the value 3 within the data set defined by the Ranges of the last 14 bars:

Value2 = PercentRank(3, Close, 14);