Skip to main content

BETA for Amibroker (AFL)

ammeet over 14 years ago Amibroker (AFL)

  • Rating:
    2 / 5 (Votes 3)
  • Tags:
    amibroker

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

1. arian
about 14 years ago

couldn’t get how does it work. it is neither indicator nor exploration. please explain.

Leave Comment

Please login here to leave a comment.