August 10


Improving The Simple Gap Strategy Part 5

By Jeff Swanson

August 10, 2015

automated trading, Automated Trading Development, EasyLanguage, ES, gap

In the last article of the series, Improving The Simple Gap Strategy Part 4, I continued my attempt to improve the Simple Gap strategy by testing dynamic stops and targets. As it turned out these did not seem to offer much benefit. In this article I’m going to take what we have learned over the past couple of articles to create a modified version of the Simple Gap strategy and test it on the out-of-sample data.

If you will recall we have determined that the following two filters improved our baseline trading system.

  1. Gap Size Filter. Not taking trades when a gap is larger than 9 points. This was tested in Improving The Simple Gap Strategy Part 2
  2. Previous Day Filter. Only taking trades when the previous day was a down-day. This was tested in the article, Improving The Simple Gap Strategy Part 3

I then combined these two filters into a single system which will be tested on the out-of-sample data. Before we do that, here is our testing environment:

Testing Environment

All the tests within this article will use the following assumptions:

  • Starting account size of $100,000
  • In-sample dates are from 1998 through December 31, 2012
  • Out-of-Sample dates are from January 1, 2013 – July 31, 2015
  • One contract was traded per signal
  • The P&L is not accumulated
  • $20 was deducted per round-trip for slippage and commissions

Out of Sample Test

I then loaded a chart with the out-of-sample historical data and tested our new strategy with the two filters. The strategy produced the following equity graph:

Not so inspiring! It looks like our system is not performing as expected as it drills into negative territory. With nearly 60 trades in the out-of-sample data I feel this is a decent representation. The equity peek did happen in April of 2014. Since that time, it’s been nothing but down hill!

Let’s take a look at our baseline system on the out-of-sample data. It’s possible that even the baseline is underperforming which may help suggest that our filters are not to blame. Below is the equity curve.

Well, this looks a lot better. Our baseline system appears to remain undefeated.


As you can see, building a trading system that works is not easy. Most ideas you come up with simply don’t work. It can take a lot of persistence and time to build, test, and refine an idea that’s worthy of trading with real money. In this case, the baseline system appears the best system. Those rules were written years ago and still appear to work. However “work” seems to be a relative term. The performance on the out-of-sample segment shows some strong drawdowns and a recent pause in the climbing equity curve which may in itself not be out of the ordinary. Nonetheless, it’s only averaging about $16 of profit per trade over the past 200 trades. That includes the $20 deduction for slippage and commissions. In my book this system is probably not worth trading with such a low average profit.

The next best option for this particular system just might be to tweak the profit target and stop loss. Several people have pointed out to me that a $400-profit target and a $400-stop loss appear to be optimal values. If I use those values with the baseline system and run it through the out-of-sample data I get the following equity curve:

Not much of an improvement. Once again, the original profit target and stop loss values appear to be better. In the end, there may be other filters that will work, or a better set of profit and stop targets. A possible idea to test would be to modify the profit target and stop loss value over a rolling period. This can be accomplished with the help of a walk forward optimizer. Perhaps, periodically changing the the profit target and stop loss value would help this system. It’s certainly something to consider.

I’m reminded on why I don’t trade the opening gap on the S&P as I’ve yet to find an automated system that works to my standards. I’m not saying such a system(s) doesn’t exist, it’s just I’ve yet to see it.

Other Article In This Series

Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

  • Try testing (i) yesterday’s Gap did not fill (measured by high / low did not cross the previous days close (ii) yesterday had volatility expansion (measured with ATR). These two patterns on their own and in combination may tempt you to revisit the idea of Gap trading.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage.