PureBytes Links
Trading Reference Links
|
Paul,
I thought I posted this to the forum. Her'es what I posted:
Here you go - great code! You'll need to adjust the "from" and "to"
under dates to get it to work.
While we're on the subject does anyone know what a reasonable
timetable is for correlations to be "statistically significant"? is
it 3 months, 6 months, a year? It seems to me like it is all
personal preferance as relationships change. Reason why I was
looking for this code in the first place is I'm looking for ETFs
that are a good hedge against crude and natural gas prices, mainly a
hedge against energy. Best candidates are PPH, SWH, IYZ ~ approx -
0.75+ correlations. I can't say I'm all that excited about using
the software holdr and telecom I-share as a hedge! Some of the
country specific European ETFs look like better candidates with
correlations in the -0.40 neighborhood
// 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, "Paul A." <amibroker@xxxx> wrote:
>
> > Test =
> >Correlation( Var1, Var2,
> >8 );
>
> It's common to compare the ROC's of the price, often the 1-day
ROC's. Not
> the raw prices themselves.
>
> How'd you solve the problem? I'd be curious to run the code
myself.
>
> Thanks.
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|