System Trader Success
Share It!

Testing A Simple Gap Strategy

I was recently reading a book (more like a pamphlet, it’s only 93 pages), “Seven Trading Systems for the S&P Futures” by David Bean. I’m always interested in “older” books that have defined rules based systems in them to see if they really stood up to the test of time, and to kind of have an extended “Walk Forward Test” without having to wait around a couple of years. The book was written and published in 2010 and has 7 pretty basic gap trade systems. Quickly, for those unfamiliar with gaps, we are simply talking about the distance, or the “gap” in price, from the previous day’s close to the following day’s open. Pictured below is an example of a “gap-down” from the 9/10/14 close to the 9/11/14 open. As you can see, the closing price from 9/10 was 1987.25, the following morning on 9/11 we gapped down to open at 1979.

Gap-Example

This is also an example of a trade that would have been executed using this strategy, going long on the open of 9/11 at 1979.00 and exiting 4 points or $200 dollars later at 1983.00.

I’m only going to be looking at the Gap Fill #1 strategy from the book for the purposes of this article. There are several things that I really like about this strategy. First, it’s dead simple. Your hamster could manually trade it. Second, because it’s so simple, we can easily test the robustness of all the inputs and make sure the strategy was not overly optimized just to create a pretty equity curve (which for the purposes of the book, if Mr. Bean is being honest w/ himself, he did in fact do because he didn’t include any slippage or commissions in the book, and choose some rather, shall we say, convenient start and stop times for the back test). Anyway, let’s jump right in and see if Gap Fill #1 stands the test of time.

Trading Model Rules:

  1. Uses a 100 day SMA bull/bear regime on the daily chart
  2. If the S&P opens inside of the previous day’s range, and above the previous day’s close, a short will be taken (in a bear regime, aka S&P is under the 100 day SMA)
  3. If the S&P opens inside of the previous day’s range, and below the previous day’s close, a long will be taken (in a bull regime, aka S&P is above the 100 day SMA)
  4. There is a $500 stop loss, a profit target of $200, or exit on the close.

Notes:

  • $20 round trip was taken out for slippage and commission
  • Assumes $100,000 account
  • Only trades 1 contract and does not reinvest profits
  • Data1 is the ES 1-minute chart
  • Data2 is the ES daily chart

Baseline Results

The original in-sample test from the book was conducted from 06/02/2005-05/28/2010.

  • Net Profit: 13,152.50
  • Profit Factor: 1.39
  • No. of trades: 358
  • Annual rate: 2.48%
  • % time in the market: 1.61 %
  • % winners: 75.42%
  • Avg. Trade Net Profit: $36.74
  • Sharpe: 0.13
  • Max Drawdown: $2,175

Baseline-eq-curve

So that’s a pretty looking equity curve even with a taxing deduction for slippage and commission on 358 trades, but you probably figured it would test okay for the in-sample data, otherwise it wouldn’t have been published in a book. So let’s test the out of sample data from before the in-sample start, and after the in-sample ends, running up to September of this year. Basically, the same sample Jeff likes to use, inception of the ES up until now. This is where the rubber will really meet the road and we can see if the idea really holds up to the test of time.

In-Sample & Out-of-Sample Results

Testing the whole sample, out-of-sample previous, in-sample, and out of sample after 01/01/1998-09/02/2014 (side note: 1st trade in this test was on 10/1998 due to maxbar setting).

  • Net Profit: $28,837
  • Profit Factor: 1.21
  • No. of Trades: 1,335
  • % winners: 72.43%
  • Avg Net Profit: 21.60
  • Annual rate of return: 1.52%
  • Sharpe: -0.05
  • Max Drawdown: 4,552.50

All-sample-eq-curve

It looks like we might just have a winner here! BUT (there’s always a but) clearly we have some good news AND bad news here. The good news is that it literally, this month, (doing this study in the middle of Sept/2014) just made new all-time equity highs. The bad news, is that it was basically flat for the first 5 years of the study, from the beginning of 1998 to June of 2003 to go along with another long period of no new highs from the middle of 2011 to the middle of 2013. On a side note, never ever believe a day trading system’s results without commission and slippage included. As with this study that has 1,300 trades taken over 16 years, if I hadn’t added commission and slippage you would probably think this was the holy grail of systems, as you pay just as much in slippage and commission ($26,000) as you make in net profit. So now that we’ve seen that the baseline system has stood the test of time, let’s dig deeper and see if we can improve the variables and make sure they are robust enough to trust.

Testing Regime Lookback Period

Let’s start by testing the regime filter to make sure that it does in fact improve the performance of the strategy. We’ll first test the effectiveness by removing it from the trading rules. Below is the equity curve with the regime filter removed.

EQ-curve-without-regime

So it clearly helps, you get about 10k more in profit, with half the trades and a much better equity curve. Next let’s test the robustness of the regime filter by using TradeStation’s optimization feature. We will test values from 50-400 in increments of 50.

Testing-Regime-Lookback

So as you can see above, 100 is in fact the best value with the net profit tailing off ever so slightly the larger you make the regime filter. The good news is that all values are positive and everything over 100 performs very well with very little difference between 100 through 250. Next let’s test the profit target.

Testing Profit Target

We’ll test from $100 through $1,500 in increments of $100.

Testing-Profit-Target

More good news again, from the value of 200 and beyond, basically every value is incredibly robust with all targets testing positive. This is really where you can mold the system more to your personality without curve fitting. If you like more winners and small profits, that’s just fine. If you like going for the homeruns with less winners, that’s fine as well…whatever suits your trading personality. So clearly 400 is the best, but it is almost certainly an outlier. BUT…..I actually don’t have a problem if you want to use 400 as your profit target, as long as you don’t expect it do as well as it did in the back test. It made about 39k in the test, but I think a more realistic expectation would be in the neighborhood of 30k which seems to be top of the line for several other values.

Here is a quick look at the percentage of winning trades for each profit target tested. As you can expect, the higher the profit target, the lower percentage of winners you’ll have. It is interesting to note that after about a 600 dollar profit target, the percentage of winners really doesn’t drop off at all.

Testing-Profit-Target_And_Prcnt_Winners

Lastly, let’s test the stop loss.

Testing Stop Loss

We’ll test $100 through $1,000, using increments of $100.

Testing-Stop-Loss

So it’s very interesting that 400 is both the best value for a stop and a profit target. (I wonder if that has anything to do with the historical ATR of the ES?) As you can see, a stop that is too tight hurts the performance and a stop that is too large, while profitable, also hurts performance. The good news being that there is a large “sweet spot” for a stop, anywhere from 300 through 700 which is plenty robust. This is yet again another way you can mold the strategy to your trading personality.

Conclusion

So all in all I think this is a great strategy that has stood up to the test of time as well as our own testing. BUT (I told you there is always a but) there is so much more that could be tested on this strategy to improve the results and weed out some of those really bad periods. There are clear market “regimes” where the market gaps and then backfills the gap, and there are clear “regimes” where the market may be trending and leaves a lot of gaps open. A couple ideas to explore might be to test “equity curve” trading to capitalize on times when the market is in the correct regime for this strategy. Another idea is testing a profit target and stop loss that adjust to volatility or ATR to minimize risk and maximize possible return. What about using the gap fill itself as a target and half that value as a stop? A good position sizing model that can improve leverage in the regimes where this system thrives and decrease it or not trade at all during the bad regimes could really improve results and filter out a lot of unproductive trades. Anyway, that’s just a couple of ideas, I would love to hear others.

The ATR (Average True Range) for the ES in the entire sample is just over 18 handles. So my very simple and offhand theory on why $400 is the best stop and profit target, assuming 18 is the average range so 9 handles would approximately be the daily midpoint 9*50=450….so the theory then being your stop is on average just big enough to not get stopped out and just large enough to capture the optimum profit assuming two way trading (as only about 28% or so of days end up as trend days). Again, just my cocktail napkin theory.

— By Ben Little

You can follow me on Twitter @TRUmav. I always enjoy sharing and brainstorming ideas with like-minded traders.

Download

Other Article In This Series

About the Author Ben Little

Ben has been a private trader for over 7 years and is now a TradeStation Trading App Developer. Finding and exploiting edges is his game, as he's not only a trader but a professional sports handicapper. You can find him on Twitter @TRUmav for financial commentary, or @BtheHouse for sports betting commentary. If your interested in more models like the one above, check out BtheHouse.com. Ben always enjoys sharing and brainstorming ideas with like-minded traders, bettors, and investors.

follow me on:

Leave a Comment:

19 comments
Add Your Reply