AB =
CreateObject("Broker.Application");
AA =
AB.Analysis;
WL =
AA.Filter(0,
"WatchList");
WLSyms =
CategoryGetSymbols(categoryWatchlist,
WL);
rsSymNo =
rsScore = rsiSymNo = rsiScore = rocSymNo = rocScore = Cum(0);
rsSymNo =
rsiSymNo = rocSymNo = rsScore = rsiScore = rocScore =
TOTSymNo =
TOTScore =
////These
symbols added for Ranking of Sum of Ordinal Ranks
Cum(0) -
99999999;
rsScore[0] =
rsiScore[0] =
rocScore[0] =
TOTScore[0] =
1e100;
procedure Rank_Sym
(rsSymNoX, rsScoreX)
{
rsSymNo =
IIf(rsScoreX >
rsScore, IIf(rsScoreX
<= Ref(rsScore,
-1), rsSymNoX,
Ref(rsSymNo,
-1)),
rsSymNo);
rsScore =
IIf(rsScoreX >
rsScore, IIf(rsScoreX
<= Ref(rsScore,
-1), rsScoreX,
Ref(rsScore,
-1)),
rsScore);
}
if
(Name() ==
StrExtract(WLSyms,
0))
{
WLQty = 0;
for (i =
0; (Symbol =
StrExtract(WLSyms, i))
!= "";
i++)
{
WLQty = WLQty + 1;
SetForeign(Symbol);
RSIx = SelectedValue(RSI(14));
ROCx = SelectedValue(ROC(C,
14));
RestorePriceArrays();
rsSymNo = rsiSymNo;
rsScore = rsiScore;
Rank_Sym (i, RSIx);
rsiSymNo = rsSymNo;
rsiScore = rsScore;
rsSymNo = rocSymNo;
rsScore = rocScore;
Rank_Sym (i, ROCx);
rocSymNo = rsSymNo;
rocScore = rsScore;
}
for (i =
1; i <=
WLQty; i++)
{
StaticVarSet("RSI_Rank_" +
NumToStr(RSISymNo[i],
1.0),
i);
StaticVarSet("ROC_Rank_" +
NumToStr(ROCSymNo[i],
1.0),
i);
}
}
for (i =
0; i <=
1000;
i++)
{
if
(Name() ==
StrExtract(WLSyms,
i))
break;
}
RSI_Rank =
StaticVarGet("RSI_Rank_" +
NumToStr(i,
1.0));
ROC_Rank =
StaticVarGet("ROC_Rank_" +
NumToStr(i,
1.0));
Tot_Rank =
SelectedValue(RSI_Rank +
ROC_Rank);
//////////////////////////////////////////////////////////
// Add code to rank
Tot_Rank
//////////////////////////////////////////////////////////
if
(Name() ==
StrExtract(WLSyms,
0))
{
WLQty = 0;
for (i =
0; (Symbol =
StrExtract(WLSyms, i))
!= "";
i++)
{
WLQty = WLQty + 1;
rsSymNo = TOTSymNo;
rsScore = TOTScore;
Rank_Sym (i, Tot_Rank);//Seems like
Tot_Rank is not getting sorted
ToTSymNo = rsSymNo;
TOTScore = rsScore;
}
for (i =
1; i <=
WLQty; i++)
{
StaticVarSet("TOt_Rank_" +
NumToStr(TOTSymNo[i],
1.0),
i);
}
}
Tot_Rank_RANK =
StaticVarGet("TOT_Rank_" +
NumToStr(i,
1.0));
///////////// End of Ranking Total Rank
///////////////////
ROCn =
SelectedValue(ROC(C,
14));
RSIn =
SelectedValue(RSI());
Filter =
BarIndex() ==
SelectedValue(BarIndex());
AddColumn(RSI_Rank,
"RSI",
1.0);
AddColumn(ROC_Rank,
"ROC",
1.0);
AddColumn(Tot_Rank,
"Tot",
1.0);
AddColumn(Tot_Rank_RANK,"ComboRank",
1.0);
AddColumn(ROCn,
"ROC",
1.3);
AddColumn(RSIn,"RSI()",1.3);