Lot you want to find high beta stock in your portfolio.

Beta is basically measuring the volatility of stock. So if Yesbank has Beta reading over period of 50 days as 1.8 so this means if Nifty will move 1, Yesbank will move 1.8.

Use the code below for Beta Exploration.

Run explore on Amibroker for n last days = 1 //Setting when you click analysis in amibroker



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", "NSEnifty" );


Plot
( Beta( symbol, Param("Periods", 21, 2, 100 ) ), _DEFAULT_NAME(), ParamColor( "Color", ColorCycle ) );


Filter
=
1;

AddTextColumn
(FullName(), "FullName");

AddColumn
(Close, "Close", 1.2);

AddColumn
(Beta("NSEnifty",50), "Beta",1.2); //Replace NSEnifty with your Nifty Symbol here