Historical Volatility for Amibroker (AFL)
bigotilyo over 5 years ago Amibroker (AFL)
The Rules
Summary of rules as in the article.
Keep track of the daily returns Calculate the 20-day historical volatility of your returns When volatility exceeds 30% and the return over the last three days is negative, exit all positions Restart the strategy when volatility falls below 30% and the return over the last three days is positive.Each strategy will have a different volatility threshold which one must test for. He also suggests possible using different volatility values in steps 3 & 4 to reduce whipsaws.
Indicator / Formula
Copy & Paste Friendly
// Provided by Cesar Alvarez www.AlvarezQuantTrading.com
// Historical Volatility
lenPeriod = Param("Periods",100,10,1000,1);
HV = 100 * StDev(log(C/Ref(C,-1)),lenPeriod) * sqrt(252);
Plot(HV, "HV("+lenPeriod+")", ParamColor( "Color", colorRed ), ParamStyle("Style") );0 comments
Leave Comment
Please login here to leave a comment.