BETA for Amibroker (AFL)
ammeet over 14 years ago Amibroker (AFL)
Got this from one of my friend but don’t know the author.This would provide the beta details of the stocks. This is a good one. Try it and let me know the results.
Indicator / Formula
Copy & Paste Friendly
function Beta( BaseSymbol, N )
{
Chg = ROC( C, 1 );
ChgBase = ROC( Foreign( BaseSymbol, "C" ), 1 );
return ( N * Sum( Chg * ChgBase , N ) - Sum( Chg, N) * Sum( ChgBase, N ) ) /
( N * Sum( ChgBase ^ 2 , N ) - Sum( ChgBase, N ) ^ 2 );
}
symbol = ParamStr( "Symbol", "^NDX" );
Plot( Beta( symbol, Param("Periods", 21, 2, 100 ) ), _DEFAULT_NAME(), ParamColor( "Color", ColorCycle ) );1 comments
Leave Comment
Please login here to leave a comment.
couldn’t get how does it work. it is neither indicator nor exploration. please explain.