PureBytes Links
Trading Reference Links
|
Try this - Adjust the time period to what you are looking for
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 = C > .01;
AddTextColumn (FullName(),"Ticker",1.0);
list =
GetCategorySymbols (
categoryWatchlist,
5 );
for (
NumTickers= 0; NumTickers < 99 AND StrExtract(
list, NumTickers ) !=
"" ;
NumTickers++ );
for (
Col= 0;
Col<NumTickers; Col++)
{
Ticker1 =
Name ();
Ticker2 =
StrExtract ( list, Col);
Var1 =
ROC (Foreign(Ticker1, "C"), 1);
Var2 =
ROC (Foreign(Ticker2,"C"),1);
Test =
Correlation ( Var1, Var2,
180 );
Color =
IIf (Test>.45,
colorBrightGreen,
IIf (Test<0,
colorRed,
colorYellow));
Color =
IIf (Ticker1==Ticker2,
1 , Color);
AddColumn ( Test,
Ticker2, 1.3,
1 , Color);
} jeremy7827110028 <jberkovits1@xxxxxxxxxx> wrote:
I have a watch list with 5 stocks. I am trying to code a correlation matrix that reports the correlation for each pair for the last 10, 30, 90, and 252 bars. I am new to AmiBroker and have no clue on how to approach this one. Any help would be greatly appreciated.
Regards,
Jeremy
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com
For other support material please check also: http://www.amibroker.com/support.html
---- LSpots keywords ?>---- HM ADS ?>
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
---- LSpots keywords ?>
---- HM ADS ?>
YAHOO! GROUPS LINKS
|