PercentRank
- calculate percent rank

Indicators
(AmiBroker 5.40)


SYNTAX PercentRank( array, range )
RETURNS ARRAY
FUNCTION INPUTS:
  • array - input data
  • range - lookback range

Returns percent rank (0...100) of the current element of the array within all elements over the specified range.

A value of 100 indicates that the current element of the array is the highest for the given lookback range, while a value of 0 indicates that the current value is the lowest for the given lookback range.

It is equivalent (but 2x faster) to:

function PercentRank2( Data, Periods)
{
   Count =
0;
  
for ( i = 1; i <= Periods ; i++ )
   {
   Count += Data >
Ref( Data, -i );
   }
  
return 100 * Count / Periods;
}

EXAMPLE
SEE ALSO

References:

The PercentRank function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.