Percentrank() for Amibroker

Some readers have asked me to share the Percentrank() function for Amibroker. As I have found it somewhere in the blogosphere (can’t remember where though), I have no problems sharing it.

Kudo’s to the original creator! – QD

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

2 thoughts on “Percentrank() for Amibroker

Leave a Comment