How to get maximum ranking number?

wlnum = GetOption( "FilterIncludeWatchlist" ); 
List = CategoryGetSymbols( categoryWatchlist, wlnum ) ;
// delete static variables - DO NOT forget the asterisk (wildcard) at the end
StaticVarRemove( "ValuesToSort*" );

// fill input static arrays
if( Status( "stocknum" ) == 0 )
{
for ( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ )
{
    SetForeign( sym );
     Value = ROC( C, 10 );
    RestorePriceArrays();
    StaticVarSet( "ValuesToSort" + sym, Value );
}

// perform ranking
StaticVarGenerateRanks( "rank", "ValuesToSort", 0, 1224 ); // normal rank mode
}
		Rank  = StaticVarGet ("RankValuesToSort" + Name()); 
Filter= 1;
SetSortColumns(4);
AddColumn( Close, "Close" );
AddColumn( Rank, "Rank", 1.0, colorDefault, colorDefault );

I'm using the code above to rank stocks. I want to find the maximum ranking number to convert the static var ranks generated into a percentile score. Could anyone please help me?
RSpctile = Prec(100 - 100*Rank/MaxRank,2);
screenshot_1571626383

@ThachCuong,

See,

Thread closed until @ThachCuong verifies license status.