PureBytes Links
Trading Reference Links
|
forget it again jhart_1972 <jhart_1972@xxxxxxxxx> wrote:
Below is the code I used for a correlation matrix. It sets up the tickers fine in the AFL box but there is no output (no results). Does anyone know what may be wrong?
Thanks - Jason
// Exploration to create //Correlation matrix
// Be sure to set //"Apply to" to desired wishlist Name
// Also, change the //watchlist number ("2" in example below) to the correct number //(zero based).
Buy=Sell=Short=Cover=0;
Filter = Status("LastBarInTest");
list = GetCategorySymbols( categoryWatchlist, 20 );
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, 8 );
Color = IIf(Test>0, colorBrightGreen, IIf(Test<0, colorRed, colorWhite));
Color = IIf(Ticker1==Ticker2, 1, Color);
AddColumn( Test, Ticker2, 1.3, 1, Color);
}
--- In amibroker@xxxxxxxxxxxxxxx, "jhart_1972" <jhart_1972@xxxx> wrote: > > forget it, I think I found one in the archives > > --- In amibroker@xxxxxxxxxxxxxxx, "jhart_1972" <jhart_1972@xxxx> > wrote: > > > > I was wondering if anyone had a code that put together a > correlation > > matrix for a given watchlist. For example, say you have a > watchlist >
> of stocks, ETFs, Indexes, etc., I'd like to see how they correlate > > with one another. I was thinking it would be ideal for up to 10 > > securities, after that it may become a little overwhelming. > > > > I picture it in a table format looking a little like this (I hope > it > > posts OK) > > stk A Stk B Stk C Stk D > > stock A 1.0 .5 .25 .5 > > stock B > > stock C misc. corr numbers here > > stock D > > > > > > I haven't attempted to code this yet, so I figured I'd check here > >
first. I could either tackle the coding or face the wife's wrath > > over a crown molding project I've been putting off for weeks. If > > I'm smart I'll do the latter. > > > > thanks - Jason
Check AmiBroker web page at: http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor |
ADVERTISEMENT
| |
|
Yahoo! Groups Links
|