In a recent article titled "A Simple and Timeless Way to Trade the S&P 500 Successfully", the author proposes a simple market timing strategy by buying SPY when the SPX is above its 300-day MA and moving into cash when the SPX is below its 300-day MA. I've seen many proposals similar to this which I classify as "skimming" algorithms. The idea, and it's quite enticing, is to simply figure out a way to participate in bull markets and avoid bear markets. Like most of what I've read on investing and trading, this is also asking the wrong question; a better question would be to flip this on its head and ask "what signal can I use to short the market effectively?" But that's a subject for another article. Typically, it has been my observation that most skimming algorithms perform rather poorly although they do tend to reduce volatility.

So let's look at the claims made in the original article and see if we can verify them and examine the proposed method analytically and objectively. The original article has not one graph or table included so the first order of business is to develop a performance graph of such a method.

The starting point I generally use is a spreadsheet. While spreadsheets have some limitations they're quite useful for "breadboarding" or taking a quick look at a model. So first we need data; Yahoo! Finance provides historical data on most stocks and ETFs and you can download that data directly to a .csv file (comma separated values) that is easily imported into Microsoft Excel or Open Office Calc. So for SPY the data starts on Jan 29, 1993, which is a decent starting point and represents 20+ years of historical data. Yahoo! Finance unfortunately orders the data from the most recent to the least so first we need to reverse the order of the data. Once we've done that it's a simple matter to calculate the 300-day MA by moving to a new cell in row 300 and entering "=sum(E1:E300)/300" and then copying that for all cells greater than 300. Now we have a column of 300-day SMA data and it's a simple conditional =IF to determine if the closing price of SPY on a given date is greater or lesser than the 300-day SMA.

So let's say yesterday the closing price of SPY was below the 300-day SMA and today the closing price of SPY was above the 300-day SMA; the earliest opportunity we can act on that knowledge is the next day in the spreadsheet; however to make the spreadsheet easier to construct I simply do the following calculation (next day's closing price - today's closing price), since this calculation is then correct for periods where the price is above or below the 300-day MA for extended periods. What is actually being modeled here is making the "switch" or transition between cash and long (or vice versa) at the closing price for the day in which the crossover occurs. This is realizable in the real world since we can pre-calculate the next day's closing price at which a crossover would occur. Once we have the daily point differences we convert that to a percentage by dividing by the previous day's closing price and then use that to add or subtract from a running total of the model's performance. So what does the spreadsheet show?

So first of all we see that the model underperforms simply owning SPY by a ratio of 0.92:1 for the 19 year period. That's not very impressive. But let's make sure we understand any simplifications, approximations, or other statistical anomalies that may be at work here.

First there's dividends. The blue line in the chart above is the raw closing price data for SPY, and SPY does pay a decent dividend. If SPY is above its 300-day SMA and you're long SPY according to the model you collect the dividend and so that's a wash compared to a simple buy and hold strategy. However, when the price of SPY is below its 300-day SMA and the model is in cash you do not collect the dividend while someone simply buying and holding SPY would. So the performance ratio is understated by that amount and the actual performance ratio is less than 0.92:1.

Next we've deviated from the model by using the 300-day SMA of SPY rather than the 300-day SMA of the actual index SPX. So that's one thing we'll need to correct and look at. In addition, the spreadsheet model starts on 4/6/1994 rather than 1/29/1993 since the spreadsheet needs 300 days of SPY price data to begin calculating a 300-day SMA. We'll correct that as well.

To improve the fidelity of the model we'll need to go beyond a spreadsheet and actually write code. This can be done fairly easily in whatever language you want, the calculations are fairly straightforward. I write in FORTRAN and have the program output a .csv file that I can then import into Excel to do simple post-processing and graphing. So here's the performance graph that's output from a more accurate representation of the model; we've used the actual SPX values, preloaded 300 days prior to Jan 29, 1993, so the model starts with the inception of the SPY ETF. Again, we'll simply leave the dividend accounting off the table but it's clear that the baseline buy and hold SPY performance will be understated by the amount of the dividend paid during periods when the model is in cash.

So here's the new performance graph output from the higher fidelity model.

So in this case the spreadsheet was quite accurate; the graphs look nearly identical except the performance ratio dropped to 0.91:1 as a result of adding 300 days to the beginning of the chart.

Let's look at some of the claims made in the original article:

There would have been several brief exchanges into cash: June and August, 2010; August, October, and December 2011, and finally once in June, 2012. In the context of a bull market, these dips below the 300 day M/A were event-driven, short-lived and proved to be buying opportunities.

Reading this one would think that there were 6 transitions into cash for the period June 2010 through June 2012; in fact there were 11 separate transitions to cash (and symmetrically, 11 transitions to long). This can create quite a bit of churn when the SPX is close to its 300-day MA and is bouncing back and forth. In total there were 102 transitions for the entire 20+ year period so for this model broker commission costs would be negligible.

Let's add one wrinkle to the model that I know from previous investigations will likely improve performance. As it turns out, all of the gains in the S&P 500 occur during the daily opening gap; in fact a strategy that simply buys the close for SPY every day and sells at the next day's open actually slightly outperforms the overall index. So instead of transitioning from long to cash at the close of the day where the SPX is greater than its 300-day SMA we'll wait until the following day at the open and to be fair we'll do the same for a transition from cash to long.

Well now at least we have a 1.0:1 performance factor for the 20+ year period.

Another claim made in the original article involved using the leveraged Ultra SPY ETF SSO in place of the SPY ETF.

Of note, the return for the leveraged SSO is approximately double the return on the SPX 500 used in our methodology.

SSO and other leveraged ETFs (especially the inverse leveraged ETFs) are the stock market's equivalent of plutonium. In the wrong hands they can wreak havoc and devastation and are extremely dangerous. So first let's look at SSO's performance over its life; this is a fairly new creature with a birth date of June 21, 2006.

Here we've plotted the Adjusted Closing Prices for SPY and SSO beginning June 21, 2006 through 2013 normalized at the starting point. So if we bought shares of SSO on June 21, 2006 and held them through today, even with SPY (Adjusted) moving up from 107 to 177 points we'd be well behind a simple buy and hold strategy for the unleveraged ETF. Ouch. So it's very important to use leveraged ETFs intelligently and in very small doses. So how does the 300-day SPX model perform if we use SSO instead of SPY when the model calls for us to be long?

So now we have a 1.08:1 performance factor using SPY with the 300-day SPX model and a 1.47:1 performance factor using SSO for the much shorter 7-year data span (2006-2013). Not exactly a double.

Finally, let's ask a simple question. Why 300? It really doesn't take a lot of analysis to conclude that 300 is not an optimal number. So let's look at a range of potential SMAs from 2 through 500.

So we can quickly see that using 300 for a SMA is suboptimal for this model, and 379 is the winner.

So now we have a performance ratio of 1.34:1 (compounded) for the 20+ year timeframe. Just as a point of reference, the current model we trade SPY with has a 3.73:1 uncompounded performance ratio for the same 20+ year timeframe.

**Disclosure: **I am short SPY. 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.

Comments()