[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] How to add "Alpha" to an exploration column?



PureBytes Links

Trading Reference Links

Hello - I cut and pasted Anthony's code and made a function for your use. I 
did not

check the accuracy of the algo for beta and alpha.  Note that Alpha is 
calculated relative

to a symbol representing the market, here it QP's symbol for NASDAQ 100 
!NDX.  Anthony used

^NDX

Hope this helps.

JOE



function Alpha(C, MktSymbol,Periods)

{

P=Foreign(MktSymbol,"C",1);

//****Beta***********************/

Beta=(( Periods * Sum(ROC( C,1) * ROC(P,1),Periods )) - 
(Sum(ROC(C,1),Periods) * Sum(ROC( P,1),Periods))) / ((Periods * 
Sum((ROC(P,1)^2 ),Periods)) - (Sum(ROC(P,1 ),Periods)^2 ));

//*****Alpha*********************/

return (Sum(ROC( C,1) ,Periods) - ( Beta ) * Sum( ROC( P,1) ,Periods ) )/ 
Periods;

}

MktSymbol ="!ndx"; //Must be enclosed in "....."Quotations.

Filter = 1;

AddColumn(Close,"Close",1.2);

AddColumn(Volume,"Volume",1.0);

AddColumn( ROC( Close, 15 ), "ROC(15)", 1.1 );

AddColumn(C/HHV( High, 240 ), "% 52 week high", 1.2);

AddColumn(StochK(5,1), "5 Day Position",1.1);

AddColumn(Alpha(C,MktSymbol,240),"Alpha", 1.2);

----- Original Message ----- 
From: "personal592002" <personal592002@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, June 25, 2006 5:59 PM
Subject: [amibroker] How to add "Alpha" to an exploration column?


> How to add "Alpha" to an exploration column?  "Alpha" as defined buy
> this entry in the AFL library.
>
> http://www.amibroker.com/library/detail.php?id=157&hilite=Correlation
>
> For this exploration how do I get the last line working?
>
> Filter = 1;
>
> AddColumn(Close,"Close",1.2);
> AddColumn(Volume,"Volume",1.0);
> AddColumn( ROC( Close, 15 ), "ROC(15)", 1.1 );
> AddColumn(C/HHV( High, 240 ), "% 52 week high", 1.2);
> AddColumn(StochK(5,1), "5 Day Position",1.1);
> //AddColumn(Alpha(C,240)"Alpha", 1.2);
>
>
>
>
>
>
>
> 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
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>