Introduction to moving average crossovers
Moving averages are the most widely used indicators in technical analysis, and help smoothing out short-term fluctuations (or volatility) in order to highlight a longer-term trend. Traders classically use the past daily (or intraday) prices to compute their time series, applying different variations of moving averages. In this article, we are going to look at a basic momentum strategy looking at a simple moving average (SMA) crossovers as our signal to buy or sell the underlying asset, gold. In this strategy, traders build a trading signal based on moving average crossovers, by taking a long position if the shorter (faster) moving average is above the longer (slower) moving average, and a short position if the shorter moving average is below the longer moving average (see more here).
For instance, the famous terms ’Golden Cross’ and ’Death Cross’ result from crossovers of the 50 SMA and the 200 SMA. ’Death Cross’ is when the 50 SMA crosses the 200 SMA to the downside, signalling a potential long-term bear market on gold (figure 1).
Which parameters should we use to build a SMA crossover strategy?
Even though the 50 and 200 SMAs are probably the most popular moving averages that investors tend to watch carefully, we first have to check if there have been different combinations in the past that have generated ‘enhanced’ returns. Therefore, using daily prices on gold, we look at different combinations of SMA crossovers, with the short SMA ranging from 2 to 50 and the long SMA ranging from 5 to 200. We then compute the Sharpe ratio of each of the combination, which we define as the ratio of the annualized returns over the annualized volatility of the entire sample:
As there are many different combinations, we decide to use a heatmap to detect if there are some ‘hot’ and ‘cold’ areas. How to read a heatmap is pretty straightforward:
- The red areas are ‘hot’ areas, which implies that the SMA combinations have been working well in the past few years.
- The green area are the ‘cold’ areas, which are the combination to avoid if you want to build a systematic strategy on gold using SMA crossovers.
In our first backtest, we look at the daily price of gold since 2016; results are shown in Heatmap 1A and 1B. It is important to know that the parameter of the short SMA cannot be bigger than the parameter of the long SMA (blue shaded area).
The ‘Death Cross’ strategy stands at the bottom right of the entire heatmap (Heatmap 1B) and has generated a Sharpe ratio of 0.75 over the past four years, which is less than the ‘long-only’ strategy (long GLD) with a Sharpe ratio of 0.87. The combination that has generated the highest performance is the (35,37) SMA crossovers, with a Sharpe ratio of 1.36.
Figure 2 (left frame) shows the equity curve of the long-only (GLD) versus the traditional ‘Death Cross’ and the (35,37) SMA crossovers. The (35,37) SMA crossover strategy shows that investors would have captured the late declining by going short GLD in the past few months. Figure 2 (right frame) shows the changes in signal for the two strategies; while the Death Cross strategy is very slow and has changed signals only 5 times in the past 5 years (currently sending a buying signal as 50D SMA is trading above the 200D SMA), the (35,37) has a higher frequency and has been sending a sell signal since mid-September to the exception of a few days. As we look at daily prices, we assume that the transaction costs are negligible for a commodity such as gold.
Heatmap 1. Sharpe ratios of SMA crossovers strategy using daily prices of gold since 2016
Heatmap 1A (Long SMA from 5 to 105)
Heatmap 1B (Long SMA from 105 to 200)
In our second backtest, we look at the daily price of gold since 2010 in order to capture the bearish momentum in gold prices that occurred in the first half of the last decade; results are shown in Heatmap 2A and 1B. First, we can notice that the Sharpe ratio are significantly lower, which is not surprising as gold consolidated sharply after reaching its previous high of in September 2011. The ‘Death Cross’ strategy has generated a Sharpe ratio of 0.29, which is again much lower than the ‘long-only’ strategy with a Sharpe ratio of 0.37.
The winner combination this is the (27,53) SMA crossover generating a Sharpe ratio of 0.64.
Figure 3 shows the equity curve of the long-only (GLD) versus the traditional ‘Death Cross’ and the (27,53) SMA crossovers. We can notice again that the Death Cross strategy have barely changed signals in the past decade.
Heatmap 2. Sharpe ratios of SMA crossovers strategy using daily prices of gold since 2010
Heatmap 2A (Long SMA from 5 to 105)
Heatmap 2B (Long SMA from 105 to 200)
Even though a lot of investors tend to focus significantly on the Death Cross 50/200 signal when defining bullish or bearish trends coming from momentum strategies, we have seen that this strategy has performed poorly in either the past 5 years or since 2010. We know that past performance does not guarantee future returns, but it is important to add the most powerful ‘quantitative tool’ to your fundamental analysis. At the moment, fundamentals signals on the GLD are mixed; on one hand, the weak USD and the large amount of negative-yielding debt are pricing in stronger GLD, but rising yields in the US could weigh on the pressure metal in the short run. As we saw in the article, the best combinations are also sending bearish signals on GLD.