I don't remember where I got this, but it runs an arbitrary watch list against 
itself to get a correlation matrix

ReefBreak

// Exploration to create Correlation matrix original by Herman Van Ven Bergen 
// In AutoAnalyzer, set Apply to -> Use Filter -> WatchList to same list as 
Param -> ListNumber (zero based)
// Then set LookBackPeriods
// Modified by ReefBreak
// April, 2008

Listnumber      = Param("Listnumber",1,1,263,1);
LookBackPeriods = Param("Lookback Periods",3,1,252,1);

Buy=Sell=Short=Cover=0;
Filter = 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, color);
                        }
        } 

--- In [email protected], Rajiv Arya <rajivary...@...> wrote:
>
> 
> correlation function
> 
> To: [email protected]
> From: joseph_occhipi...@...
> Date: Thu, 7 Jan 2010 18:46:49 -0800
> Subject: [amibroker] Non-correlated markets in AB
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
>   
> 
> 
>     
>       
>       
>       
> Hi all
> 
> Im in the process of looking into a couple of different trading strategies in 
> commodities. I am keen to trade a basket of commodties simultaneously but i 
> am mindful of not chosing a group that are strongly correlated (say 80%+), be 
> it positively or inversely. 
> 
> My question to AB users is as follows - is there a function in AB that allows 
> me to gauge such information? 
> 
> Or is it merely a case of eyeballing several charts and overlaying them on 
> each other?
> ieal scenario would be to trade say 8 - 10 markets, all mostly uncorrelated
> 
> could be:
> 5 commodities;
> 3 FX;
> 2 indicies.
> 
> Cheers
> Joe
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>       
> See what's on at the movies in your area. Find out now..
> 
> 
>     
>      
> 
>     
>     
> 
> 
> 
> 
> 
> 
>                                         
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft's powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/196390706/direct/01/
>


Reply via email to