Now lets do some backtesting for the simple moving average index crossover trade system. How did this systematic buy/sell scheme perform when backtesting it with different time windows on the DAX index?


				
					Fig. 1: SMA Performance comparison for DAX

Fig. 1: SMA Performance comparison for DAX


				
					Fig. 2: Simple moving average Performance comparison for DAX (without tradecosts)

Fig. 2: Simple moving average Performance comparison for DAX (without tradecosts)

If we look at figure 1, we see the Performance of the timewindows for 1 - 1000 days, calculated on the DAX data for the last 3750 trading days (15 normal years). The green line shows the Buy & Hold performance, this is what you would have got when buying the index 15 years ago and then waiting until today, that would give you a yield of 9.36% p.a.

Now let this yield be the benchmark for our backtesting. The best simple moving average timewindow would have been the one with 298 days, giving a yield of 13.76%.

You can see in the figure that a great portion of the higher timewindows would have beaten the Buy & Hold yield, especially the SMAs in the range of 250 to 320 days und higher then 450 days produce good results. Small timewindows below 250 days did worse then the benchmark in the backtesting, with very small windows you also could produce a strong negative performance.

Number of trades

A factor which greatly influences the moving average tradesystems performance is the trade fee & taces with many trades. The taxes when selling with profit do a good damage, as profit gets taken out of the system instead of being reinvested. If you like fantasy then you can see the performance without trade costs in figure 2.

Now lets see how many trades would have been done for every moving average in our backtesting in fig. 3.


				
					Fig. 3: Amount of Trades for each simple moving average value

Fig. 3: Amount of Trades for each simple moving average value


				
					Fig. 4: Performancechart of SMA 298 and Buy & Hold for the DAX

Fig. 4: Performancechart of SMA 298 and Buy & Hold for the DAX

We see that the most trades are done at lower SMA values, this makes sense as these provide the smallest smoothing of the index curve and run closest to it, producing the most crossovers.

So we seen in retrospect that some timewindows did better in the backtest for the moving average, but can it be generally said that these are ‘good’? That they allow an outperformance in future? It may be that the SMA298 was extremely good in a short time period long ago, but did bad since then - and this is overshadowed by the long timerange we look at.

Because of that, lets look at the progress of the SMA298 performance in figure 4. It starts with an investment at 100% 15 years ago (3750 days before today). As a comparison also see figure 5 with the DAX chart and the SMA curve. As you can see in fig. 4 the moving average strategy stays behind from the beginning as it invests a bit later when the upward trend is signalized.

In the sideway phase at days 2900 - 2600 the performance sinks because of the many false signals. The advantage of the moving average strategy in this backtest comes from the signaling of the strong downward trends in days 2300-1700 and 500-200 where it doesnt lose money.


				
					Fig. 5: DAX Chart with SMA298

Fig. 5: DAX Chart with SMA298

Of course the question arises, if you would have gotten a more constant performance chart when using a different timewindow for the moving average, as no underperformance at the beginning or in the sideways phase.

Comparing all timewindows

Especially in the days of 2800-1800 you dont look happy with the SMA298 choice compare to simple buy & hold. Because of that lets take a look at all performance curves for the timewindows up to 1000 days in fig 6. The performance curves are drawn behind eachother, so have a 3 dimensional graphic now, giving a topology of the simple moving average cross over performance for the last 15 years. The performance can be seen as height and color.


				
					Topology of simple moving average performance for DAX

Fig. 6: Topology of simple moving average performance for DAX


				
					Topview for moving average performance on DAX

Fig. 7: Topview simple moving average performance for the DAX

What you want to have is a moving average which produces a continous mountain and is high. Because you have a problem with occlusion in the 3D view there is a top view in figure 7 where the performance is encoded only by color. To compare, fig. 8 shows a topview of a (artifical) topology for the Buy & Hold performance.


				
					Buy & Hold Performance for DAX

Fig. 8: Topview Buy&Hold Performance for the DAX

If we look at the performance curves of all the simple moving averages, we see that the SMA298 is not the one with the best continous performance, but it does only arise to top performance in the last 500 days. The high SMAs beginning at 450days did better in the days from 2800-800 then lower ones and the 298 day simple moving average. Now we are searching for an moving average which (for all the time) had nearly no phase where it was worse then Buy and Hold.


				
					Underperformance for simple moving average on DAX

Fig. 9: Average underperformance of the simple moving averages


				
					Performance chart of DAX and sma of 707 days

Fig. 10: Performance of SMA 707 and Buy & Hold

To find this, the daily average negative aberration from the buy & hold curve was calculated. In fig. 9 you can see these for every SMA value. The y axis is logartihmic and the first 150 SMAs were left out because the magnitudes of difference were so big. You see that the SMAs with the smallest underperformance lie in the range of 670 to 750 days, the lowest is the SMA707, its performance curve can be seen in fig. 10, it has hardly a phase with underperformance and still is better then buy and hold in the end.