Hi All,
I am using the function below to get ranking of particular stock in the
watchlist according to defined function. Problem is that for backtest its too
slow as it recalculates for each stock.
Is there a way to store the rankings once and then just read them or pass them
between different stocks during portfolio backtest?
Any pointers are greatly appreciated. Thank you.
function GetValue(index)
{
return C[index];
}
for (z=1; z<=BarCount-1; z++)
{
local List;
List = CategoryGetSymbols( categoryWatchlist, WatchlistNumber );
for( i = 0; ( SymbolNumber= StrExtract( List, i ) ) != ""; i++ )
{
SetForeign(SymbolNumber);
TemporaryValue = GetValue(z);
RestorePriceArrays();
TickersValue[i] = TemporaryValue;
}
MyPosition[z]=0;
for( n = 0; n<=i; n++ )
{
MyPosition[z]=IIf(MyValue[z]<TickersValue[n],MyPosition[z]+1,MyPosition[z]);
}
}