**Data**

Like in my previous articles, we'll try to get a statistically significant, and objective analysis. While examples like 'look how good a 200-SMA worked for Microsoft (NASDAQ:MSFT) in 1993' or 'Amazon (NASDAQ:AMZN) recent movements show that earnings forecasts don't work' may be amusing stories, but they would be purely anecdotal. We need to focus on a much broader simulation.

First, while the ideal would be to run tests for thousands of different stocks, we will instead focus on the market as a whole, by simulating market-timing strategies on the S&P 500. If we consider stock prices to follow a Brownian motion, then their combination is also Brownian.

Second, the simulations must span a duration as long as reasonably possible. One could argue that the stock market wasn't exactly working the same way a century ago, so we won't try to go as far. As a matter of fact we could, until recently, get S&P 500 data as early as January 3rd, 1950 with the Yahoo! Finance's API . Yahoo! unfortunately stopped the service without warnings a few weeks ago. For more recent data, we can use the wonderfully simple Tiingo.com service, but it doesn't give index prices, only securities. Therefore we'll use SPY, the largest S&P 500 ETF as a proxy. Since the S&P 500 index and SPY ETFs numbers are not exactly the same, we scale the historical Yahoo data to match. The updated data contains almost 17,000 trading day prices and is available, as a CSV file. We'll show performances both for the entire period 1950-2017, but also for the last 10 years only. The last decade is interesting because we had both a huge drop (2008), followed by an impressive but very volatile growth.

For the sake of simplicity, we will ignore both trading costs and dividends payments, which means our results will benefit from a bias toward market-timing versus buy-and-hold. Such bias seems acceptable, though, as the main goal is to make a comparison between various market timing strategies, rather than assessing the soundness of trying to time the market in general.

**Time frame**

The frequency at which stocks are traded has potentially a huge impact. A strategy could be successful on a very short-term basis (a few hours), but disastrous for low frequency trading (one or two trades a year). Both time horizon have their advantages and drawback.

Long term trading gives fewer data points. If we trade only once every 10 years, we may need centuries to assess the validity of the results. On the other hand, the fewer the trades, the more reliable the results: a strategy that requires to trade every hour could give wondrous results while back-testing, but turn out to be disastrous when traded for real, because of transaction costs and slippage. A TD Ameritrade study indicated than investors trade on average about 15 times a year. This indicates investors are willing to change position every few week. In accordance with this behavior, we put our re-balancing frequency at once every four weeks. This means a theoretical maximum of 13 trades per year.

**Performance Measurement**

How we measure the performance of a given strategy is a surprisingly controversial topic. We'll distinguish three kinds of measurements:

*Returns*

Absolute performance is the easiest measurement: take the final portfolio value and compare it with the initial investment. $100 invested in the S&P 500 in January 1950 become $22,994 after 67 years, a total annualized return of 5.65%.

A more time-neutral measurement is to average the returns over the whole periods. We calculate the returns for each trading cycle (which as a reminder is 4 weeks), average and annualize them. In that case, the last 67 years of the S&P 500 show an average annual return of 9.71%.

*Accuracy*

Accuracy ratios indicate if we were right to avoid the stock market at a given time. We can calculate the 'market beating ratio', which is the percentage of time a strategy performs better than the market, or less discriminatingly the 'not losing to market ratio', this is the percentage of time a strategy perform better or equally than the market. Two other similar measurements are the 'positive returns ratio', which shows the percentage of times returns are positive, and at last the 'loss prevention ratio', which indicates how often a strategy prevented losses.

*Risks*

Returns don't take the notion of risk into account. Risk is important for several reasons. First, an investor may need to exit the market at any time, and may not have the luxury of waiting 30 years before cashing out. The riskier the investment, the more likely he is to exist at a painful time. Second, investors are, for better or worth, human beings, and human beings are far from rational, cold-blooded animals. Between a portfolio shaped like a steady climb or a roller-coaster, few would choose the second option. At last, the riskier a strategy, the more likely investors will be to throw the towel and stop following it.

This means we need to focus on risk-adjusted-returns. By far the most popular is the Sharpe Ratio. I personally think it's close to worthless, because I have yet to encounter an investor who would consider making more money that average to be a 'risk', and because standard deviation doesn't take the sequence of events into account. A see-saw of ups and downs and an initial big drop with a last-minute gain can have the same variance, but would induce very, very different feelings amounts investors.

Drawdowns, which are peak-to-trough declines in a portfolio value are a better risk indication. We can measure both the maximum drawdown, which indicates the worst loss an investor could have encountered, and the averages, which gives the Ulcer index (with quadratic means). The Martin Ratio is returns divided by the Ulcer Index. Here we'll use a slightly modified version, which I call the 'Modified Martin Ratio', by dividing returns by 1 plus the Ulcer index. The Modified Martin Ratio is always computable, and always below the returns.

Another measurement we'll use is my own 'V2 Ratio'. (You may want to look at a graphical explanation here), which is particularly applicable here since we want to compare if we can do better than the market.

**Strategies**

Our goal here is not to be 'smart' or creative, but only to compare some popular market-timing strategies with objectivity.

**50 Days EMA**

We'll start with a simple and well-known idea: invest in the stock market only if the current price is above its 50-days exponential moving averages. The underlying idea is that markets always show momentum, while the moving average allows to filter out some of the noise. Obviously the length of the moving average window is crucial important. For whatever reason, 50 days is very often advised. And the results are…. not so good.

S&P 500 - 1950 to 2017 | Buy and Hold | 50 Days EMA |
---|---|---|

Average Return (annualized) | 9.71% | 5.85% |

Total Return (annualized) | 5.65% | 3.53% |

Positive Return Ratio | 61.16% | 35.14% |

Market Beating Ratio | - | 17.92% |

Not Losing to Market Ratio | - | 73.99% |

Loss Prevention Ratio | - | 48.29% |

Sharpe Ratio | 0.05 | 0.04 |

Maximum Drawdown | 49.33% | 28.56% |

Modified Martin Ratio | 0.40 | 0.40 |

V2 Ratio | - | -0.03 |

Trades per Year | - | 4.28 |

The 50 days EMA provide some downward protection, reducing the maximum drawdown from 52% to 39%, but at a cost of reducing the average returns to only 5.85% per year. With a Modified Martin Ratio of 0.4, same than the 'buy and hold' strategy, it doesn't make much sense to follow the 50 days EMA strategy.

In the graph above, the green bars indicate when the strategy is beating buy-and-hold, that is when it's out of the market which is going down, and red when it's performing worse, meaning the market is going up while we're 'out'.

**50-200 Days crossover**

Day-to-day price is by itself quite a noisy signal. The idea with the popular 50-200 days crossover strategy is to compare two somewhat de-noised signals: the 50-days and 200-days exponential moving averages. Any time the 50 days average is over the 200 days indicated a bullish market in which it is worth investing.

It's simple, basic even. But it works…

Although it decreases average returns, like any market timing strategy would do, it compensates by significantly reducing risks. Maximum drawdown is only 18%. Both Sharpe and Modified Martin ratio are up.

S&P 500 - 1950 to 2017 | Buy and Hold | 50-200 Days crossover |
---|---|---|

Average Return (annualized) | 9.71% | 8.61% |

Total Return (annualized) | 5.65%5.25 | % |

Positive Return Ratio | 61.16% | 35.14% |

Market Beating Ratio | - | 17.92% |

Not Losing to Market Ratio | - | 73.99% |

Loss Prevention Ratio | - | 30.84% |

Sharpe Ratio | 0.05 | 0.06 |

Maximum Drawdown | 49.33% | 29.16% |

Modified Martin Ratio | 0.40 | 0.60 |

V2 Ratio | - | -0.01 |

Trades per Year | - | 0.57 |

This strategy was able to successfully exit the market before it reached bottom in 2002 and 2008. It didn't do so well in 1987, where it exited just before the rebound.

**5-20 days crossover**

It is worth trying another strategy with shorter, popular periods, the 5-20 days moving average crossover. Results show these periods are best avoided, as they provide less downward protection while reducing the returns by a factor of almost 2. At 3.78 changes of position in a year on average, they're also more likely to generate extra trading expenses.

S&P 500 - 1950 to 2017 | Buy and Hold | 5-20 days crossover |
---|---|---|

Average Return (annualized) | 9.71% | 5.01% |

Total Return (annualized) | 5.65% | 3.00% |

Positive Return Ratio | 61.16% | 37.11% |

Market Beating Ratio | - | 14.80% |

Not Losing to Market Ratio | - | 75.95% |

Loss Prevention Ratio | - | 39.88% |

Sharpe Ratio | 0.05 | 0.04 |

Maximum Drawdown | 49.33% | 35.37% |

Modified Martin Ratio | 0.40 | 0.21 |

V2 Ratio | - | -0.04 |

Trades per Year | - | 3.78 |

Interestingly, the accuracy numbers are still pretty good, which tends to indicate the weakness of this strategy is that it misses big market rebounds.

**5-20 days reverse crossover**

Since being in the market when the 20 day EMA is above the 5 day EMA performs poorly, a naive assumption is that doing the opposite should produce good performance. But that's clearly not the case: investing when the 5 day average is below the 20 days gives even worse results, with a modified Martin ratio of 0.2 versus 0.21, and a worse 'not losing to market' ratio at only 63%, as illustrated by the numerous red columns.

S&P 500 - 1950 to 2017 | Buy and Hold | Reverse 5-20 days crossover |
---|---|---|

Average Return (annualized) | 9.71% | 4.52% |

Total Return (annualized) | 5.65% | 2.59% |

Positive Return Ratio | 61.16% | 24.16% |

Market Beating Ratio | - | 22.31% |

Not Losing to Market Ratio | - | 63.01% |

Loss Prevention Ratio | - | 60.12% |

Sharpe Ratio | 0.05 | 0.03 |

Maximum Drawdown | 49.33% | 41.59% |

Modified Martin Ratio | 0.40 | 0.20 |

V2 Ratio | - | -0.04 |

Trades per Year | - | 3.79 |

**Above 50 and 200 days average**

Another popular market-timing technique amongst chartists is to consider the market bullish when today's prices are above both the 50-day and the 200-day averages. Again, performances are poor, although it does provide some downward protection, since the maximum drawdown is only 21%, less than half what an investor could have lost with buy-and-hold. Surprisingly, this strategy requires to trade quite often, with an average of 2.52 changes in position every year.

S&P 500 - 1950 to 2017 | Buy and Hold | Above 50 and 200 days average |
---|---|---|

Average Return (annualized) | 9.71% | 5.41% |

Total Return (annualized) | 5.65% | 3.29% |

Positive Return Ratio | 61.16% | 37.34% |

Market Beating Ratio | - | 16.07% |

Not Losing to Market Ratio | - | 76.18% |

Loss Prevention Ratio | - | 43.30% |

Sharpe Ratio | 0.05 | 0.04 |

Maximum Drawdown | 49.33% | 21.20% |

Modified Martin Ratio | 0.40 | 0.33 |

V2 Ratio | - | -0.03 |

Trades per Year | - | 2.52 |

**Above 200 days average**

This is provably the most basic yet efficient strategy: revisit if you should stay in the market by comparing today's price with the 200-days average. If it's above, stay, if it's below, exit. Simple, yet impressively efficient… This prevents 31% of the losses and reduces maximum drawdown to 16% while still keeping the average return at 7.8%.

S&P 500 - 1950 to 2017 | Buy and Hold | 200 days MA |
---|---|---|

Average Return (annualized) | 9.71% | 8.09% |

Total Return (annualized) | 5.65% | 4.95% |

Positive Return Ratio | 61.16% | 44.86% |

Market Beating Ratio | - | 12.83% |

Not Losing to Market Ratio | - | 83.70% |

Loss Prevention Ratio | - | 34.58% |

Sharpe Ratio | 0.05 | 0.06 |

Maximum Drawdown | 49.33% | 30.60% |

Modified Martin Ratio | 0.40 | 0.49 |

V2 Ratio | - | -0.01 |

Trades per Year | - | 1.08 |

**Above 350 days average**

There's also some robustness in the moving average span, since increasing from 200 days to 350 doesn't hamper results much. The number of trades per year goes down to only 0.62 (so a bit more than once every two years), yet that strategy reacted relatively quickly, exiting shortly after the peaks of 2000 and 2008.

S&P 500 - 1950 to 2017 | Buy and Hold | 350 days MA |
---|---|---|

Average Return (annualized) | 9.71% | 7.81% |

Total Return (annualized) | 5.65% | 4.75% |

Positive Return Ratio | 61.16% | 46.71% |

Market Beating Ratio | - | 11.68% |

Not Losing to Market Ratio | - | 85.55% |

Loss Prevention Ratio | - | 31.46% |

Sharpe Ratio | 0.05 | 0.05 |

Maximum Drawdown | 49.33% | 26.82% |

Modified Martin Ratio | 0.40 | 0.49 |

V2 Ratio | - | -0.02 |

Trades per Year | - | 0.62 |

**Moving Average Convergence Divergence**

The MACD, as it is commonly called, is a very popular technique amongst chartists. Here again the idea is to compare moving averages of different periods (12 and 26 days). Instead of comparing them directly, the MACD consists in computing a 9-days moving average of their difference, then compare the difference with that smoothed version. I don't want to criticize MACD too harshly (I used it myself with some success in my technical analysis days), but as a timing strategy, the results are shockingly bad. The average return is only 4.88%, while maximum drawdown is still 28%.

S&P 500 - 1950 to 2017 | Buy and Hold | MACD |
---|---|---|

Average Return (annualized) | 9.71% | 3.88% |

Total Return (annualized) | 5.65% | 2.28% |

Positive Return Ratio | 61.16% | 28.90% |

Market Beating Ratio | - | 19.09% |

Not Losing to Market Ratio | - | 67.75% |

Loss Prevention Ratio | - | 51.40% |

Sharpe Ratio | 0.05 | 0.03 |

Maximum Drawdown | 49.33% | 37.74% |

Modified Martin Ratio | 0.40 | 0.20 |

V2 Ratio | - | -0.04 |

Trades per Year | - | 4.89 |

For those who think the MACD is better applied to shorter trading periods, we can show that re-balancing even once a week produces similar results:

**Zenvestment 30/90**

About 8 years ago, I started researching my own market-timing strategy. Some basic Machine-learning optimization identified the potential in comparing two exponential moving averages, of periods 30 and 90 days. It is worth revisiting those results on a broader period.

As we can see, overall the 30-90 days strategy performs significantly better than most of the other strategies analyzed here.

S&P 500 - 1950 to 2017 | Buy and Hold | Zenvestment 30-90 |
---|---|---|

Average Return (annualized) | 9.71% | 7.81% |

Total Return (annualized) | 5.65% | 4.75% |

Positive Return Ratio | 61.16% | 46.71% |

Market Beating Ratio | - | 11.33% |

Not Losing to Market Ratio | - | 86.82% |

Loss Prevention Ratio | - | 30.53% |

Sharpe Ratio | 0.05 | 0.06 |

Maximum Drawdown | 49.33% | 26.16% |

Modified Martin Ratio | 0.40 | 0.59 |

V2 Ratio | - | -0.01 |

Trades per Year | - | 0.59 |

**PE 10**

Also called the Shiller Price/Earning Ratio, this calculates the price to average earnings from the past ten years, adjusted for inflation using the Consumer Price Index. More data is available here. The idea is that if prices are too high, a crash is more likely. Once issue is that the prices fluctuated widely. The average P/E ratio since 1950 is 19, but it stayed pretty low until the sixties, when it reached a peak of 100, only to go down continuously in the late seventies, then crawling up again for 2 decades.

As a consequence, it is hard to setup a constant limit under which we'll be 'in' the market and out otherwise. We can't de-trend the numbers, because that would require to know in advance what future P/E ratios would be. Consequently, we simply calculate a moving average ratio, and invest in the market only when the current ratio is comparatively low.

Let's be clear: the results are catastrophic. Not only this strategy performed on average very poorly, returning only 2.28% on average, but it also provided poor downward protection, which a maximum drawdown still above 50%. My guess is that although a low P/E ratio makes sense from an economics perspective, it is a lagging indicator, and the market is irrational enough to not care anyhow.

S&P 500 - 1950 to 2017 | Buy and Hold | Low PE10 |
---|---|---|

Average Return (annualized) | 9.71% | 2.41% |

Total Return (annualized) | 5.65% | 1.19% |

Positive Return Ratio | 61.16% | 24.05% |

Market Beating Ratio | - | 20.23% |

Not Losing to Market Ratio | - | 62.89% |

Loss Prevention Ratio | - | 54.52% |

Sharpe Ratio | 0.05 | 0.02 |

Maximum Drawdown | 49.33% | 46.84% |

Modified Martin Ratio | 0.40 | 0.07 |

V2 Ratio | - | -0.06 |

Trades per Year | - | 2.71 |

**Conclusion**

As expected, market timing is difficult, and not simple strategy works all the time (it's probable even worse for complex ones...). That being said, at least three techniques significantly reduce risks with lowering returns too much, at least from what we can deduct from the past 67 years of data:

50-200 days EMA crossover | 200 days moving average | Zenvestment 30-90 days EMA | |
---|---|---|---|

Average Return (annualized) | 8.61% | 8.09% | 8.44% |

Total Return (annualized) | 5.25% | 4.95% | 5.15% |

Positive Return Ratio | 48.21% | 44.86% | 47.98% |

Market Beating Ratio | 11.45% | 12.83% | 11.33% |

Not Losing to Market Ratio | 87.05% | 83.70% | 86.82% |

Loss Prevention Ratio | 30.84% | 34.58% | 30.53% |

Sharpe Ratio | 0.06 | 0.06 | 0.06 |

Maximum Drawdown | 29.16% | 30.60% | 29.16% |

Modified Martin Ratio | 0.60 | 0.49 | 0.59 |

V2 Ratio | -0.01% | -0.02 | -0.01 |

Trades per Year | 0.57 | 1.08 | 0.59 |

**Disclosure:** I/we have no positions in any stocks mentioned, and no plans to initiate any positions within the next 72 hours.

I wrote this article myself, and it expresses my own opinions. I am not receiving compensation for it (other than from Seeking Alpha). I have no business relationship with any company whose stock is mentioned in this article.