# Developing A Simple Model To Day Trade SPY

This post will introduce several simple day trading strategies using the well know ETF SPY. We'll begin with a simple observation, do some analysis, and then step by step build a model to trade this ETF in a unique way. The strategy and model is extensible to other ETFs but for simplicity we'll simply focus here on SPY, the S&P 500 ETF. The original "edge" was discovered quite by accident in previous studies of ETF behavior and modeling.

We'll start with a very simple strategy: Buy the Close and Sell the next day's Open. That would seem to be counter-intuitive, but like many things in the stock market and life in general don't be surprised if the conventional wisdom is wrong. After all the conventional wisdom would say - you're exposing yourself to a great deal of risk, either overnight risk or weekend risk with such a strategy. However a simple analysis proves that initial reaction wrong; following this simple strategy actually outperforms, by a small margin, a simple buy-and-hold SPY strategy. For this article we'll look at all of the data for the SPY ETF that is available; the inception date for the SPY ETF was Jan 29, 1993 and we'll show data in this article through the end of 2Q 2014. We'll also neglect the effect of dividends; this is a valid omission since following the simple strategy with the actual ETF will have you as a valid holder of the ETF on each ex-dividend date.

When we begin development of a model and look at optimizations we look at a range of data and statistics. Specifically, the key output elements we focus on are winning percentage (# of days that the model or strategy is net positive / total number of days) and the average percent gain (or loss) for both winning days and losing days. Here's the data for the very simple strategy Buy the Close, Sell the Open for SPY from Jan 29, 1993 to Jun 30, 2014:

Total Days | Winning Days | Losing Days | Average Daily Gain | Average Gain | Average Loss | Gain/Loss Ratio | |

Buy the Close Sell the Open | 5393 | 3076 57.04% | 2317 42.96% | 0.035% | +0.393% | -0.440% | 0.893 |

The total percentage gain for this simple Buy the Close Sell the Open strategy is 189.06% vs the actual gain for SPY over the period of 188.84%.

So looking at the statistics we can make two quick observations; first the winning percentage is actually quite good at 57%, however when the strategy is wrong the average loss on a losing day is greater than the average gain for a winning day (-0.440% vs +0.393%). The first question one might ask is "Can we find a filter to reduce the average loss on losing days?". There are a wide range of potential candidates and strategies that one can investigate in that pursuit; for our study here again we'll stick with something very basic - the Simple Moving Average [SMA] for SPY. Here's the hypothesis we'll test: when SPY is above a specific SMA we'll employ the strategy, however when SPY is below that same SMA we'll reverse the strategy and go short (one way would be by buying the inverse SPY ETF SH at the close and selling at the next day's open). Graph 1 below is a plot of the total percentage gain for a range of simple moving averages where the green line is the percentage gain when SPY is above a given SMA and the red line is the percentage gain when SPY is below a given SMA.

So the first thing we notice is that there is indeed an optimal value for a SMA in this study (there's actually two distinct peaks on the graph but we'll come back to that later) and the optimal value for our SMA is 392. By going Long SPY only when SPY is above its 392-day SMA we can improve the winning percentage and average gain and we can also see that there is a small net overall loss when SPY is below its 392-day SMA, so indeed it would be advantageous to short SPY when that condition is met. What we now have is the basis for a simple two zone strategy; Zone 1 is when SPY > 392-day SMA and Zone 2 is when SPY < 392-day SMA, and the model is long Zone 1 and short Zone 2. Let's look at the statistics for this new strategy overall and for each Zone:

Zone | Total Days | Winning Days | Losing Days | Average Daily Gain | Average Gain | Average Loss | Gain/Loss Ratio |

1 Long | 3819 76.35% |
2213 57.95% | 1606 42.05% | 0.054% | +0.350% | -0.354% | 0.989 |

2 Short | 1183 23.65% | 577 48.77% | 606 51.23% | 0.025% | +0.724% | -0.640% | 1.131 |

Now let's compare this with an "adjusted" baseline. Why do we need to "adjust" the baseline? Because the original data started with the inception of the SPY ETF and the earliest we can begin to use the 392-day MA strategy is after the 392nd day when we can accurately compute a 392-day SMA.

Total Days | Winning Days | Losing Days | Average Daily Gain | Average Gain | Average Loss | Gain/Loss Ratio | |

Buy the Close Sell the Open |
5002 | 2819 56.36% | 2183 43.64% | 0.035% | +0.413% | -0.452% | 0.914 |

So a couple of quick observations. Zone 1 (SPY > 392-day SMA) has both an improved winning number of days and a nicely improved Gain/Loss ratio vs the baseline. We now have a strategy that produces a nearly identical gain vs loss on winning days vs losing days (+0.350% vs -0.354%) and a nice 57.95% winning number of days in Zone 1. Zone 2 (SPY < 392-day SMA) is a different animal; while Zone 2 actually has a slight bias toward losing days (51.23%) there's a significantly better gain (0.724%) on winning days vs a loss (-0.640%) on losing days.

Now let's go back and look at the second peak in the first chart. Clearly there's a secondary peak that occurs at SMA = 12, so perhaps we can improve the strategy by expanding to a four zone strategy. The 4 zones we'll create and analyze are:

Zone | Condition 1 | Condition 2 |

1 | SPY > 392-day SMA | SPY > 12-day SMA |

2 | SPY > 392-day SMA | SPY < 12-day SMA |

3 | SPY < 392-day SMA | SPY > 12-day SMA |

4 | SPY < 392-day SMA | SPY < 12-day SMA |

Here's the statistics for our new four zone strategy:

Zone | Total Days | Winning Days | Losing Days | Average Daily Gain | Average Gain | Average Loss | Gain/Loss Ratio |

1 Long |
2445 48.88% | 1315 53.78% | 1130 46.22% | +0.015% | +0.302% | -0.319% | 0.946 |

2 Long |
1374 27.47% | 898 65.36% | 476 34.64% | +0.124% | +0.422% | -0.437% | 0.966 |

3 Short |
532 10.64% | 274 51.50% | 258 48.50% | +0.050% | +0.617% | -0.553% | 1.116 |

4 Short | 651 13.01% | 303 46.54% | 348 53.46% | +0.005% | +0.821% | -0.705% | 1.165 |

Notice that this 4 Zone strategy offers no improvement in total gain vs our 2 Zone strategy - Zones 1 & 2 are Long and Zones 3 & 4 are Short. However it does offer us some guidance on what the probabilities and average gains are for each individual zone, and Zone 2 is a standout zone - with a 65% winning percentage coupled with a small negative gain/loss ratio this is a very nice zone to trade. One possible way to implement a strategy using these zone statistics would be to simply trade Zone 2 Long; you would only be day trading 27.47% of the time and yet the percentage of winning days and average daily gain are quite favorable. The total percentage gain for Zone 2 alone is 170.75% while the total percentage gain for the 2 or 4 Zone model is 237.22% vs 182.22% (1.30x) for buy-and-hold SPY adjusted for the same time period. However, being Long from one day's Close to the next day's Open a bit over 25% of the time and generating 93.7% of the overall ETF gain seems like a very nice risk/reward tradeoff. Of course, there are also 2X and 3X leveraged SPY ETFs than can be used with this strategy quite effectively.

Last, we'll simply plot the cumulative percentage gain for the three strategies against our "adjusted" baseline, the initial simple strategy, the two or four zone strategy and the Zone 2 Long only strategy. One feature that immediately jumps out from the graph is the significant reduction in volatility, especially for the Zone 2 Long only strategy.

In conclusion we've shown a couple of basic strategies that can be used to day trade SPY. The underlying methodology can also be used to develop more complex strategies. Currently we've developed 8- and 16-zone strategies for several popular ETFs and experimented with 32- and 64- zone strategies.

**Disclosure: **The author has no positions in any stocks mentioned, and no plans to initiate any positions within the next 72 hours.