A few years ago, well ok about twenty years ago, I developed an interest in share trading. Not that I ever got around to buying any shares but I did read several books and thought about ways that I might create the ultimate trading system which would bring untold riches with little risk.

By a happy coincidence I discovered the joys of backtesting trading systems. My systems were pretty simple. Of initial interest were moving average systems. It was surely pretty easy to be in the market when it was rising and out of the market when it was falling. The success of my system would be how much I gained over the index each time I exited and re-entered. For example, if my system detected that the market was falling at 4,500 and detected that the market was rising at 4,000 then I was 500 points ahead of the index. If my system got it wrong and entered at 4,000 and exited at 3,900 then I was 500 behind the index.

So now my interest has been rekindled, I decided to backtest the simplest of moving average systems on the ASX200. My program buys a share when the ASX200 crossed above the 200 day moving average and sells the share again when it crosses below. Using the software at prorealtime.com.au the program looked like this:

DEFPARAM CumulateOrders = False // Only one share traded
indicator1 = ExponentialAverage[200](close)
IF close crosses over indicator1 THEN
BUY 1 SHARES AT MARKET
ENDIF
IF close crosses under indicator1 THEN
SELL AT MARKET
ENDIF

The results are interesting. Briefly, between 31 December 2002 and 29 December 2016 the system executed 50 trades with 11 winners and 39 losses. The ASX200 went from 3,007.1 to 5,665.8 which is a gain of 2,658.7. By comparison my system gained 3,325.1. In percentage terms the ASX200 gained 88.4% and my system gained 110.5%. Not bad but not brilliant either.

The backtesting produced a few other interesting pieces of information. First was the greatest drawdown. At one stage the system lost $934.40 by consecutive losing trades. This immediately raised the question of psychology. How would I feel if that much money flowed out of my trading account. At what point would I lose confidence and abandon the system.

Second was the greatest run up. At one stage the system won $3,809.20 in successive winning trades. That’s more like it but that one winning streak won more money from June 2003 to December 2007 than the system produced as a whole. And what happened after December 2007 was that the ASX200 dropped from a peak of around 6,800 to a low of around 3,100.

At that point my system was ahead around $3,800.00 over 5 years which is pretty good when the ASX200 ended up at pretty much the same level it started at. The rest of the time is a worry. A profit of around $600.00 over 9 years when the ASX200 went from 3,100 to 5,700 is pretty lacklustre.

So I split the system in two and looked at the second period. Fortunately the backtest system has the ability to optimise so I changed my program to optimise the 200 day period. Interestingly there are two clusters. One is around 60 to 80 day moving averages which yield gains of around $800.00 over the 9 years. Then there is a cluster around 200 day moving averages which yield around $600.00 as above. The thing which got my attention though was that a 90 day moving average got a result of $452 which is worse than the 200 day moving average. In short the results are unstable. If you are building a system for the future fine tuning near an unstable parameter value is undesirable.

My first conclusion is that I need to look closer at the most profitable periods to trade a moving average system. My Second conclusion is that the instability needs to be identified. My third conclusion was that I was doing all of this after the event so fine tuning much further was likely to be optimised for the past but probably not the future.