- Trading SPY with S&P 500 Signals.
- Long and Long-Short Backtests.
- Smoothing to Reduce Whipsaws.
- Testing Different SMA Combinations.
- Bollinger Bands, Envelopes and Keltners.
- Backtesting the Filters.
- Final Thoughts and a Suggestion.
... Introduction
Yesterday I put the 200-day SMA through the wringer with some testing using the S&P 500 and various indexes. Today I will expand by using the signals from the S&P 500 and applying them to the S&P 500 SPDR. I will also show how to reduce whipsaws with a little smoothing and how to apply filters using three classic indicators.
Trading SPY with S&P 500 Signals
Before getting started, note that I will be generating signals using the S&P 500 and the trading instrument will be the S&P 500 SPDR (SPY). There is a slight difference in the two. First, the S&P 500 is obviously an index and SPY is an ETF. Second, the S&P 500 is not a total return index and does not include dividends. The default SPY chart on StockCharts is adjusted for dividends and represents a total return picture.
The dividend adjustments in SPY give it a slight upward bias because the dividends were added back to the price. Let's look at three charts for a comparison. The first window shows unadjusted SPY (_SPY), the second shows dividend-adjusted SPY (total return) and the third shows the S&P 500. StockCharts users can precede the symbol with an underscore to see unadjusted data (_SPY).
As the chart shows, breaks of the 200-day are not uniform. The red zones show breaks below the 200-day SMA, while the green zones show successful tests (non breaks). Unadjusted SPY broke the 200-day SMA in late March, early April and mid October. Adjusted SPY held above the 200-day SMA during these corresponding periods. The S&P 500 broke the 200-day SMA in early April and last week.
Adjusted data gives us the total return picture and this is more realistic for returns. It is also preferred for backtesting. After all, the dividend is part of the return. This is especially important for trend following systems that rely on extended trends. The price returns represent the cake and the dividends represent the icing. As far as signal generation, I picked the S&P 500 because it is the underlying index and the most widely followed of the three instruments.
Long and Long-Short Backtests
The first table shows the results when using the S&P 500 for signals and the S&P 500 SPDR for trades. The first line shows buy-and-hold for the benchmark. The other two lines show results using crosses above/below the 200-day SMA for signals. The second line is a long/short system that is always trading and the third line is a long only system that moves to cash when the S&P 500 closes below the 200-day SMA.
First, notice that the long only strategy (line 3) was invested 73% of the time and achieved the highest Risk-adjusted Return (CAR/Exposure = 8.05/.73 = 11.02). Second, notice that short selling on breaks below the 200-day SMA was not an effective strategy. The Maximum Drawdown was -41.17% and the number of losing trades ballooned to 134. Third, the long only strategy had the highest win rate (34%) and still made money with more losing trades.
This is the nature of trend following: a few big gains make up for lots of small losses.
Smoothing to Reduce Whipsaws
Moving averages and closing prices are a recipe for whipsaw, especially when the S&P 500 nears its 200-day SMA. For whatever reason, the S&P 500 just cannot resist the 200-day SMA when it gets close and multiple crosses within a short period are common.
The first method to reduce whipsaws is to use a shorter moving average instead of the closing price. The chart below shows the S&P 500 with the 5-day SMA in green and the 200-day SMA in red. Notice that the 5-day SMA held above the 200-day SMA in late March and early April. The 5-day SMA also held above the 200-day SMA over the last five days, but is close to a cross right now.
Testing Different SMA Combinations
There are a zillion moving average combinations. We can also use simple moving averages or exponential moving averages. Guess what? There is no such thing as the perfect moving average combination. In addition, past performance does not guarantee future performance. Nevertheless, I tested three different moving average combinations and the results are shown below.
First, notice that the Maximum Drawdow (MDD) decreases as soon as we move from closing prices to the 5-day SMA for signals. Second, notice that the Win% increases from 35% to 91% as we move from the close to the 50-day SMA. Third, notice that the average gain also increases as the shorter moving average is lengthened.
Bollinger Bands, Envelopes and Keltners
Chartists can also add a filter to their moving averages to qualify signals. The first chart shows Bollinger Bands (200,1). This places an upper band 1 standard deviation above the 200-day SMA and a lower band 1 standard deviation below. Thus, price must move more than 1 standard deviation below the 200-day SMA for a break to occur.
The next chart shows SMA Envelopes (200,1), which are 1% above the 200-day SMA and 1% below the 200-day SMA. Price needs to move more than 1% below the 200-day SMA to break the lower envelope.
Keltner Channels are based on the exponential moving average and the Average True Range (ATR). The chart below shows Keltner Channels (200,1,22). The upper line is 1 ATR(22) value above the 200-day EMA and the lower line is 1 ATR(22) value below. Thus, price needs to move more than 1 ATR(22) value below the 200-day EMA for a break to occur.
It is clear from the charts above that we cannot eliminate whipsaws by using multiple moving averages or applying a filter for breaks. However, these techniques can be used to reduce whipsaws and quantify signals.
Backtesting the Filters
I went ahead and backtested the three filters above and the results are shown below. The first line repeats the results using the 5-day SMA and 200-day SMA. The Bollinger Band system performed the best overall, but had the fewest signals (13). The SMA Envelopes and Keltner Channel systems performed similar.
Final Thoughts
Keep in mind that these trend following systems require extended trends to be successful. The S&P 500 has shown a propensity to trend for extended periods over the last 25 years, but there are also periods when the index does not trend, such as May 2015 to May 2016. Also notice that these systems were invested around 73% of the time over the last 25 years. This means they were on sell signals around 26% of the time.
I have tested lots of combinations and found it quite hard to beat the 50-day/200-day cross for the S&P 500. The biggest downside is the distance price must move to produce a crossover. Currently, the 50-day SMA is still over 4% above the 200-day SMA and this means more downside is needed to produce a signal. After some tinkering, I think the 5-day/250-day SMA combination offers some promise. Check it out on the charts and see what you think.
Questions, Comments or Feedback?
I cannot promise to response to all correspondence, but I will read it and take into under consideration. I greatly appreciate all feedback because it helps me improve the commentary and provides ideas for the future. Sorry, I do not take symbol requests.
Plan Your Trade and Trade Your Plan.
- Arthur Hill, CMT
Senior Technical Analyst, StockCharts.com
Book: Define the Trend and Trade the Trend
Twitter: Follow @ArthurHill