Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi smator
As Johnathan has said it seems that Beta may be what you're looking for. Look for the Beta indicator in the Indicator dropdown list. To use the basic code with an exploration you should be able to modify my variation of that indicator and use it for several indices in one exploration (if that's useful).
{Beta Updated}
{Roy Larsen, 2009}
{User settings}
N:=Input("Beta Updated, periods",1,100,21);
X:=Input("Index, 1=DJIA 2=US$ 3=FTSI 4=HS 5=SPX",1,5,1);
{Referenced index options}
S1:=Security("C:\Equis\Stocks\World Indices\$DJ",C); {DJIA}
S2:=Security("C:\Equis\Stocks\World Indices\$DX",C); {US Dollar}
S3:=Security("C:\Equis\Stocks\World Indices\$FT",C); {FTSI 100}
S4:=Security("C:\Equis\Stocks\World Indices\$HS",C); {Hang Seng}
S5:=Security("C:\Equis\Stocks\World Indices\$SP",C); {S&P 500}
I:=If(X=1,S1,If(X=2,S2,If(X=3,S3,If(X=4,S4,S5))));
{Beta}
P1:=N*Sum(ROC(C,1,%)*ROC(I,1,%),N);
P2:=Sum(ROC(C,1,%),N)*Sum(ROC(I,1,%),N);
P3:=N*Sum(Pwr(ROC(I,1,%),2),N)-
Pwr(Sum(ROC(I,1,%),N),2);
(P1-P2)/(P3+(P3=0));
You would need to modify the data pathnames and securities for S1 to S5 variables to match the location of the appropriate indices (the existing pathnames work for me but wouldn't work for you).
For a basic exploration you could then use..
{Column A}
Fml("Beta Update")
It's an easy matter to sort exploration column results - simply click on the column header, and click again to reverse the order.
To include more than one index in your exploaration make a copy of the indicator, change the default settings so that it points to the required index and then set up the next column as below.
{Column B}
Fml("Beta Update(2)")
Unfortunately I cannot anticipate all of the areas where you might get into trouble with this procedure, but that's the way it is with most new users. See how you go and get back to us when you get stuck.
Roy
|