Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
BoH Risk Aversion Indicator for Amibroker (AFL)
Betting on Harmonics replicated RGE’s Risk Aversion Indicator which is a macro approach for measuring investors’ risk appetite. The indicator is computed by taking the correlation between rank of returns and volatility in the market over the past 21 days. Being a correlation, the indicator oscillates between -1 and 1.
This is an excellent addition to one’s tool box for gauging risk appetite using market volatility.
http://genkumag.wordpress.com/
Screenshots
Similar Indicators / Formulas
Indicator / Formula
_SECTION_BEGIN( "BoH Risk Aversion Indicator" );
//MyPercentRank Function as Coded by Ramon Cummins
function MyPercentRank( Data, Periods )
{
Count = 0;
for( i = 1; i < Periods + 1 ; i++ )
{
Count = Count + IIf( Ref( Data, 0 ) > Ref( Data, -i ), 1, 0 );
}
return 100 * Count / Periods;
}
function RAI( Length )
{
PCHG = ( C / Ref( C, -1 ) );
xRR = MyPercentRank( PCHG, 252 );
Vol = StDev( PCHG, 252 ) * 3.1;
xRAI = Correlation( xRR, Vol, Length );
return xRAI;
}
//RAI Plot
Length = Param( "Correlation Period", 21, 1, 300, 1 );
xRAI = RAI( Length );
Plot( xRAI, "", colorGreen, styleThick );
Plot( 0, "", colorDarkRed, styleThick | styleNoLabel );
Plot( 0.2, "", colorDarkRed, styleDashed | styleNoLabel );
Plot( -0.2, "", colorDarkRed, styleDashed | styleNoLabel );
_SECTION_END();6 comments
Leave Comment
Please login here to leave a comment.
Back
Values above 0.20 correspond to RISK TAKING
Values below -0.20 correspond to RISK AVERSE
Values between -0.20 and 0.20 correspond to RISK NEUTRAL
Get error unless change name of PercentRank() which is a built-in function but it is not needed as it is exactly the same result as the built-in.
AFL NOT WORKING IN 5.40 VERSION OF AMIBROKER.
@admin
dear sir, can you please correct the code…it ain’t working sir.
i’ll be very grateful of you .
thanks.
Try it now. I have renamed the rank function from ‘PercentRank’ to ‘MyPercentRank’. If your Amibroker version is not ancient you can remove the function altogether and use the built in version.
@admin
thanks sir. it worked and was really helpful.