After reading Nick Radge's Unholy Grails I was inspired to have a go at creating a system in Amibroker.
I've purchased Amibroker Pro and the historical ASX data from PremiumData.
Before having a go at my own system I thought I'd see if could replicate one of the systems in the book, just to make sure I've got some of coding basics down pat and the data setup correctly.
In the book they use PremiumData from 1/1/1997 to 30/6/2011 on the All Ords plus all delisted stocks. Starting with $100,000, including dividends & 20 positions of 5% each. 7 day liquidity and volume must exceed 500,00
I chose the bollinger band system to have a go at.
-use a 100 day moving average
-enter when the price crosses the 3 standard deviation band
-exit when price crosses the 1 standard deviation band
Having never used Amibroker I may be miles off, but this is what I came up with
SetPositionSize( 5, spsPercentOfEquity );
UpperBand = BBandTop( C, 100, 3 );
LowerBand = BBandBot( C, 100, 1 );
SevenDayAverageTurnover = MA(C*V, 7);
SevenDayAverageLiquidity = MA(V, 7);
Buy = Cross( UpperBand, C ) AND SevenDayAverageTurnover > 500000 AND SevenDayAverageLiquidity > 500000 ;
Sell = Cross( C, LowerBand ) ;
In the book the bollinger band system produced a CAGR of 33% with max drawdown of 43%.
My code attempt produces CAGR of 20% and max drawdown of 47%. I didn't expect to get a result exactly the same, but it seems a long way out.
I'm not including dividends as I don't know how you'd do that which would add a bit to the result. But at the same time, they are including delisted stocks in the book (which I'm not as the Premiumdata doesn't seem to contain this), so I should have made up some ground due to survivorship bias?
Any ideas where my code is going wrong?
Apologies for the long post.