// Exploration to create Correlation matrix original by Herman Van Ven Bergen , Modified by
GB
// Be sure to set "Apply to" to desired wishlist name ( "use filter" "Define..."
)
// Also, change the watchlist number to the correct number (zero
based)as defined in "Apply
To"
// By adjusting Parameters in AA as well as LookBack period//
Buy=Sell=Short=Cover=0;
Filter = Status("LastBarInTest");
Listnumber = Param("Listnumber",1,1,263,1);
LookBackPeriods = Param("Lookback Periods",3,1,252,1);
list = GetCategorySymbols( categoryWatchlist,
Listnumber);
for( NumTickers=0; NumTickers < 99 AND StrExtract( list, NumTickers ) != ""; NumTickers++ );
AddTextColumn(Name(),"Ticker",1.0);
for( Col=0; Col<NumTickers; Col++)
{
Ticker1 = Name();
Ticker2 = StrExtract( list, Col);
Var1 = Foreign(Ticker1,"C");
Var2 = Foreign(Ticker2,"C");
Test = Correlation( Var1, Var2, LookBackPeriods );
Color = IIf(Test>0,
colorGreen, IIf(Test<0,
colorRed, colorWhite));
Color = IIf(Ticker1==Ticker2, 1, color);
AddColumn( Test,
Ticker2, 1.3, 1, color);
}