I am having a vexing problem in trying to utilize an array created outside of a for loop and using it to populate a static variable which will serve as the input to perform a ranking with the StaticVarGenerateRanks function. When using the code below, the Exploration ranking column doesn’t show the anticipated result.
//===== Detect Watchlist ==============
wlnumber=GetOption("FilterIncludeWatchlist");
watchlist=GetCategorySymbols(categoryWatchlist,wlnumber);
//============= Symbol Ranking Using Array ==============
ValueArray=ROC(C,89);
riA=StaticVarSet("riA",ValueArray);
StaticVarGenerateRanks("Rank","riA",0,1224);
//================ Get Static Variables =================
RankriA=StaticVarGet("RankriA");
//============ Specify Columns for Exploration ============
Filter = 1;
if ( Status( "actionex" ) == actionExplore )
{
SetOption("NoDefaultColumns",True);
SetSortColumns(-4);
AddTextColumn(Name(),"Symbol",1.0,colorDefault,colorDefault,55);
AddColumn(DateTime(),"Date ",formatDateTime,colorDefault,colorDefault,75);
AddTextColumn("","X",1.0,colorDefault,colorDefault,3);
AddColumn(riA,"(riA) ",1.4,colorDefault,colorDefault,60);
AddColumn(RankRiA," ",1.0,colorDefault,colorDefault,25);
}
I have read the manual and am aware that if I put the ValueArray inside a loop and use a static variable as input for StaticVarGenerateRanks I can get a proper ranking in the Exploration column, but there is a reason why I want to achieve this in an alternative way directly from the ValueArray. I do not understand why StaticVarGenerateRanks is not receiving the necessary information to create a ranking.
Thanks to anyone who might have some suggestions as to what I am missing/doing wrong.
Russell