Hello,
I should be grateful if someone would help me to programme correctly the following part of a weekly system which is supposed to use the monthly value from a ranking.
// -- Watchlist --
Watchlistnumber = GetOption("FilterIncludeWatchlist");
Watchlist = GetCategorySymbols(categoryWatchlist, Watchlistnumber);
// -- Ranking --
MomentumPeriods = 6;
TimeFrameSet(inMonthly);
if (Status("Stocknum") == 0 )
{
StaticVarRemove("ExponentialRegression*" );
for (n = 0;(Symbol = StrExtract(Watchlist, n)) != ""; n++)
{
SetForeign (Symbol);
Slope = (exp(LinRegSlope(ln(C), MomentumPeriods))^52 - 1);
RSQ = (Correlation(Cum(1), C, MomentumPeriods))^2;
Score = Slope * RSQ;
RestorePriceArrays();
StaticVarSet ("ExponentialRegression" + Symbol, Score);
}
StaticVarGenerateRanks("Ranking","ExponentialRegression", 0, 1224);
}
Symbol = Name();
SymbolScoreM = StaticVarGet ("ExponentialRegression" + Symbol);
SymbolRankingM = StaticVarGet ("RankingExponentialRegression" + Symbol);
TimeFrameRestore();
SymbolScore = TimeFrameExpand(SymbolScoreM, inMonthly);
SymbolRanking = TimeFrameExpand(SymbolRankingM, inMonthly);
Plot(SymbolRanking, "Ranking",colorBlack);
// -- Exploration --
Filter = 1;
AddColumn(SymbolRanking, "Ranking", 1.0);
AddColumn(SymbolScore, "Score", 1.2);
If I run an exploration in either weekly or monthly periodicity, the result should be the same for a given date. However it is not, but I am unable to know what I am doing wrong.
Thank in advance for your help.
Best regards