Home / Backtesting


Backtesting the SPY 10 / 100 System

The simplest ideas are often some of the best. This is a mantra that should often be repeated by traders and investors. The simplest ideas persistently produce profits for long periods of time. I don’t know if this is because they are so simple that they are ignored or because they identify and exploit the structural architecture of markets.

With that thought in mind, I was recently reading a newer blog, Don’t Talk About Your Stocks. This gentleman wants to trade trend following systems but is relatively new to backtesting and system trading. I can identify. I have a keen memory of where I was and what I was doing when I first read Covel’s Trend Following. Similarly, deciding that I would no longer trade discretionary patterns but would instead follow quantifiable, rules based strategies, was a defining moment in my development as a trader, investor, and system designer/tester.

So the SPY 10/100 System is his first attempt at following a rule-based, quantifiable, trend following system. The only problem is that he can’t backtest it. That is a huge handicap, as it certainly stinks to have to paper trade a system for a few years before realizing that it would have worked or didn’t work. Because I like simple ideas and because I can absolutely identify with his desire, I am going to backtest it for him.

We shared a few tweets and I was able to discern the rules for the SPY 10/100 System.

The Rules:

  • Buy SPY at the next open after the 10 day simple moving average closes above the 100 day simple moving average
  • Sell SPY a the next open after the 10 day simple moving average closes beneath the 100 day simple moving average
  • I have not included any commissions or slippage. All SPY history was used for this test.

The Results:

SPY 10 100 Equity Curve

Upon first glance, the equity curve and drawdowns both look promising. It fared well during the Armageddon trade of 2008 but has missed some of the rally from 2011 to the present.

Let’s dig deeper into the system’s statistics:

SPY 10 100 Stats

The 5.73% compound annual growth rate did not beat SPY buy and hold which was 6.58% over the same time period. However, the buy and hold drawdown was significantly worse at -56.47% against the 10/100 system maximum drawdown of -35.81%. Since the system does make many more trades than buy and hold, once commissions and slippage are factored in, results would be worse. Note too that trading the open is hard to replicate using all but the most expensive data packages because of how the opening price is reported by the exchanges. I would feel safer replicating trading at the close.

Let’s look at the historical profits and losses:

SPY 10 100 Profit Table

As the stats show, and as the author indicated, this is a trend following system. This means we can expect the system to take many small losses and gather fewer large wins. Over time, the large wins make up for the many small losses. This should be intuitive. Markets do not trend all the time. Small losses are taken until the market embarks upon a strong trend.

Reading about a trend following system can be awe-inspiring as 20 years worth of profits can be encapsulated in one graph. From experience, trading such a system is entirely different. It can seem like a lifetime when the system is whip-sawed over a year or so before it catches another winning trend. Perhaps this is another reason why these simple system can endure over time. Most people can not trade them consistently and long enough to significantly erode the edge.

Profit Distributions:

SPY 10 100 Profit Distribution

I included this graph because it shows the typical trend following system profit distribution: Many small losses with fewer large wins.

The Bottom Line:

Overall, the 10/100 system is viable in that one is not likely to lose his starting equity if his life saving were to be thrown into it. If the goal is to beat buy and hold and decrease the associated drawdowns, the system is not viable. It does occur to me though that trading the SPY 10/100 system may be a good way to start trend following or system trading in that it is like learning how to ride a bike with training wheels…You can’t go very fast but you have some protection against crashes.

One final note. I backtested the system to 1928 using the non-tradeable S&P 500 index, and the results were remarkably similar to those above. This tells me that this system is not likely to break down or get much better. It will over and under-perform depending on the differing market regimes, but over time the performance should remain remarkably average with the benefit of decreased drawdowns.

Comments »

More Thinking About Factors

I’m going to ask for some input from the blogosphere with this issue.

I am a firm believer that a simple system is more robust than a more complex system. This means that a simple system is less likely to be curve-fit and more likely to survive changing market regimes without a major breakdown.

What I’m am struggling with is touched on briefly in the previous post about a 4 Factor ETF System.

As I think more about factors, I think it may be important to make a distinction about the number of inputs required to derive the factor.

For example, if we use Rate of Change to rank ETFs, then we have one factor (Rank) with one input (n periods):

Rank=ROC(n periods).

What if we instead use two differing ROCs, and weight them? That would look like this:

Rank=ROC(n periods*weight)+ROC(n periods*weight)

While “Rank” is still the single factor, we now have multiple inputs required to make this factor.

What I’m pondering is this: Are inputs equal to factors?

Comments »

Three Higher Closes in a Row: Bulls Beware

Last week I wrote about the edge that develops when the market makes consecutively lower closes. Excessive bearishness was the soup du jour, and yet the study showed a bullish edge.

Today (Wednesday) marks three consecutive higher closes, and the soup du jour is clover (bulls love clover), so I want to take a look for any edge that might exist.

The Method

This study will short the [[SPY]] at the close if the following two conditions are met:

1. The ETF will make three consecutive higher closes, AND

2. The three day rate-of-change will be greater than 5%.

The exit is a simple time-based exit.

100K per trade was used, with no compounding of gains. No commissions or slippage was added.

There were 22 trades generated from all of the available SPY data.

The Results:

The numbers running across the bottom of the graphs are the day on which the trade was exited.


Net Profit ramps up for the first three days and then begins to fade away.



The win/loss ratio is very volatile. This may be a consequence of the small data set.



While the results do suggest that there is an edge, there were too few trades to convince me that it is robust.

I want to highlight the spikes in the graphs. Ideally these graphs would show a smooth fall-off starting from day three on. The volatility in the graphs point to the possibility that the best day to exit may change quickly and often. Again, if there were more samples, these graphs may be smoother, and I’d be more likely to trust the results.

Something that is odd is that this study also shows a spike around the 12 to 13th day, similarly to the 3 consecutive lower closes study. Maybe it is just a coincidence.

Disclosure: Short the SPY as of Wednesday’s open.

Danny also mentions the 3 consecutive up closes. His custom buy/sell strength indicators are one of the few indicators that I check nightly.

Comments »

No Wonder 95% of All Traders Blow Up

For the most part, I have been Mr. Nice Guy, during my almost 3 years of financial blogging. I have chosen the “You can lead a horse to water…” approach, rather than force-feed information to those who are either unable or unwilling to understand and accept it. I have provided gifts, if you will, but because they were often wrapped in an old brown bag or the comics section of the newspaper,  many readers have chosen to ignore them, instead of unwrapping them and marveling at their splendor.

Lately though the stupidity of some of the readers of iBankCoin has been unnerving. I have become very frustrated by the generally wrong, typically under-educated, and always over-confident miscreant who declares, “There is no edge in this trade!” or “The head and shoulders top is in!” or any variety of over-the-top emotional outbursts. These folks have no idea what they are talking about.

Case in point:

The level of bearishness on the blogs today was overwhelming. Many of these folks are ready to short any stock with one, two, three, or four letters in its symbol. The fact of the matter is that shorting here is an AWFUL setup. Just plain AWFUL. Yet, any attempt to challenge this bearishness with knowledge and cold, hard data is met with derision. Basically, knowledge is being countered with foolish idiocy.

Let me show you people who were all gung ho to pile in on the short-side today what kind of odds/edge you are looking at.

The Study:

Since today was the third consecutive lower close, this study gets short the close anytime there will be three consecutive lower closes. To be clear, we will be shorting the SPY at the close, on the third consecutive lower close. I used all the data available for the SPY, with the first trade taking place in November, 1993. There were 355 instances of this setup.

The exit is a simple time exit. I am plotting what the results will be if you exit the at next close, the close two days later, and so on and so forth.

The test assumes $100,000 per trade, does not compound gains (losses, actually) and does not include commissions or slippage.


Please, if you do not understand what the graphs are showing, I will be happy to explain it. Just ask.


There is NO EDGE to shorting the SPY at today’s close, but you wouldn’t know that from listening to the myriad emotional train-wrecks who call themselves traders. No wonder 95% of all traders blow up.

Comments »

SPX Golden Cross Coming Soon

Within a few days, there will likely be much ado about the 50 day simple moving average crossing back above the 200 day simple moving average on the SPX. This is a well-known technical signal and many pundits are likely to begin mentioning it.

I decided to test its past effectiveness, if for no other reason than to be able to have an intelligent discussion about the event, should it present itself for discussion. Secondly, my bias has been intermediate term bearish, and I want to be prepared to shift towards a more neutral or even bullish bias, if warranted.

The Results:

100K Starting Equity; No Commissions or Slippage; Returns are Re-invested.

Rules, buy the next open after the 50 day sma closes above the 200 day sma. If a long position is held, sell the next open after the 50 day sma closes below the 200 day sma.

I boxed in the metrics that I think are more interesting.

Of most importance is the fact that it beat buy-and-hold. Secondly, a Golden Cross on the SPX often marks the beginning of a very long trend as the average winning trade is held 5x longer than the average loser. The high win % is notable, too.

Not to over-simplify, but this is a juicy setup for the buy-and-hope crowd.

The Equity Curve:

More Research on Trading With the 200 Day Average:

From the MarketSci Blog

Mebane Faber’s World Beta (This is fantastic research; a MUST read)

Comments »

Lazy Man: Testing Exits on an ES System, Part 4

Part 4 will focus on using Bollinger Bands for exits.

Specifically, if the bar closes outside the upper (long entry) or lower (short entry) bands, the trade will be exited on the open of the next bar. This is a very basic exit, and could easily be tweaked. For example, an exit could triggered if the high (or low) of the bar is above (or below) the bands, rather than requiring the bar to close outside the bands.

The Bollinger Bands were built around a simple (not exponential) 20 day moving average.

Let’s look at the long entry first.

Bollinger Band Long Exits

The spreadsheet below shows the results of the long entry coupled with the Bollinger Band exit.

The standard 2 deviation band works the best. The % profitable is good, but the average trade of $16.65 means that 1/3 E-mini point will be captured, on average.

The equity curve below shows the entry coupled with a 2 standard deviation Bollinger Band exit:

Bollinger Band Short Exits

The spreadsheet below shows the results of the long entry coupled with the Bollinger Band exit.

The 1.5 standard deviation band was favored by the short entry. The % profitable is very high, and the average trade shows that each trade may harvest better than 1/2 an E-mini point. Still, the win/loss ratio is very low.

The equity curve below shows the entry coupled with a 1.5 standard deviation Bollinger Band exit:

Putting It All Together: An Equity Curve of the Long and Short Entry with the Optimized Exits of 2.0 For the Longs and 1.5 for the Shorts:

Net profit of $25,200 represents an annualized return of 252.20%. The % profitable drops significantly to 57.45%. Average trade is $38.74, or not quite a whole E-mini point.

The astute observer may wonder why, when the longs and shorts are combined, the equity curve smooths out, the % profitable drops, and the sum becomes greater than the parts.

From what I can tell after looking at thousands of these trades over the last week, when the system is allowed to go long and short, it will often close a short trade and go long, or vice versa, before an exit is triggered. Basically, it stops itself out and changes direction with the trend. This hints that when I start testing stops, they might actually improve performance (it is often hard to find a system that improves when stops are added).

I think this is very very important for traders to consider, especially those who do not like to use stops. The system does not care that it took a trade in the wrong direction. When it gets a signal to go in the opposite direction, it closes out the losing trade and attempts to catch a change in the trend.

Comments »

Lazy Man: Testing Exits on an ES System, Part 3

As I am running out of time to get this information out for Lazy Man to digest before the market opens, I am going to report on only one exit tonight: the RSI(2) exit.

I had to make some minor changes in the way the testing was performed. In prior tests, all trades were executed at the close of the bar in which the trigger occurred. In order to avoid some problems, I changed the code to have the exits execute on the open of the next bar. To be clear, the signal is still generated at the close of the bar, but the trade is not made until the open of the next bar. If this is confusing, let me know in the comments section and I’ll flesh it out a bit more.

The RSI(2) Long Exit

The spreadsheet below shows the results of the entry coupled with the RSI(2) long exit:

Note that using an RSI(2) exit of greater than 70 would have yielded decent results. Also note the % profitable is the best we’ve seen yet at almost 70%.

One potential problem is that the average winning trade is only 2/3rds as big as the average loser. It is possible that this will be improved when stops are added.

Below is the equity curve generated by the RSI(2) long exit.

The RSI(2) Short Exit

The spreadsheet below shows the results of the entry coupled with the RSI(2) short exit:

Similar to the long exit, exiting after an RSI(2) reading below 20 shows promise. The percentage of profitable trades is even better with some exits exceeding 70% winners. The size of the winners compared to the losers is still an area of concern.

The average trade is approaching $50.00 which means that each trade will capture (on average) one E-mini point.

Below is the equity curve generated by the RSI(2) short exit.

Longs and Shorts Combined

Below is the equity curve for the combined long and short entries and exits:

This represents an annualized return of 294.90% with a win percentage of 65.70%.

The RSI(2) trigger for the longs was set at 85 and the short trigger was set at 10.


Using an RSI exit with this system presents some difficulties. The primary problem is that an exit can executed on a bar which also fits the criteria for entry. What this means in backtesting is that the trade is closed on the open of the bar, but then re-opened at the close of the same bar. I did not re-do the code to work around this issue.

Another problem is that some trades are entered when the exit criteria has already been surpassed. For example, the system may enter long with RSI(2) that is already greater than 85. When this happens, the system waits for RSI(2) to dip beneath the trigger level (85) , and will sell once it crosses back above 85.

When the system runs both longs and shorts, a short trade is closed out if the criteria is met for a long entry. If the system is long and the criteria is met for a short entry, then the long trade is closed and a short is entered. This adjustment helped the long side trades which leads me to believe that stops might improve results when trading only one side (long or short, but not both).

What’s Next?

Bollinger Band exits have been tested and show promise. The next installment will present the results.

Comments »