Testing A Simple Gap Strategy

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:
  • BlueHorseshoe says:

    An interesting study!

    The system described here shares a common feature with so many other successful strategies (many of which Jeff has covered here in the past): it combines short term reversion to the mean (the gap fill in this case) with a long term movement away from the mean (the trend/regime identified by the MA and giving directional bias).

    Is the max drawdown that you give the maximum intraday?

  • Shawn says:

    Is this based on cash gap or 4:15pm EST close gap?

  • Ben Little says:

    Thanks BlueHorsehoe! To answer your question, yes, the max drawdown is the Intra-day peak to valley.

  • Ben Little says:

    Shawn, the strategy is based on the 4:15 EST close.

  • Steve says:

    How do you get negative sharpe ratio with positive returns.
    I suspect your definition is not based on geometric average return

    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

    • Pete S says:

      Steve – I think the negative comes about because TradeStation defaults to a risk free return setting of 2%. Over the test period that would have been > $30k, and the strategy return is < $30k.

  • Pete S says:

    Interesting article thanks. I agree it’s useful to come across older strategies that now have walk forward data – results tend to show how difficult this trading game is!

    It looks like it’s best to avoid going long in August or short in December. That could be curve fitting; or maybe it makes sense.

  • Ben Little says:

    Steve, notice at the top of the article that the testing we ran assumed a 100,000 dollar account. For the purposes of our test, also remember that we are only trading 1 contract the entire time for every trade and never re-investing profits. You really only need a 5,000 dollar account to trade this strategy, 100,000 is just the TradeStation default. By changing nothing in the system, and only changing the amount of money we start with to 10,000 instead of 100,000, the Sharpe Ratio changes from -0.05 to 0.14. Really for individual strategies like this the Sharpe and annual rate of return are not useful as they can both be changed dramatically by simply adjusting leverage, or the amount of capital you start with. I could make all the stats and the equity curve look way better just by making a simple tweak to the position sizing, but that would be misleading.

  • Ben Little says:

    Thanks Pete, I agree nothing “proves” an edge like an extended walk-forward test…the longer the better. I’ve noticed several times in other systems that I’ve tested that the equity curves will bottom out right at the end/beginning of a year. Market seasonality is very real, Jeff has done several well written articles on it, and I also have a study on the subject on my blog if you would like to check that out as well, you can find it on my twitter page, @TRUmav

  • Marco says:

    Finally something good on gaps trading. I’m looking forward for a following post simply because this is a perfect add to my overnight trading.

  • Robert Jacobson says:

    I’ve actually been trading the Bean Gap strategy (with some modifications) for two years. I’ve generally had good luck with it. The downside is that it only trades a few times each month.

    I have one quibble: You’re testing this using Data1 on five-minute bars. That means that the opening order is placed (if the conditions are met) at 8:36. However, the book itself calls for trading this on one-minute bars, so the opening trade should be placed at 8:31.

    In my experience, the one-minute bars are much more profitable. It might be worth re-running your tests on one-minute bars. You can also optimize this by testing the results with 8:31, 8:32, 8:33 … as the time of your opening trade.

  • Ben Little says:

    Thanks for the comment Robert! I just went back and double checked the workspace, everything was tested on the ES 1 min for data 1, it was just a typo on my part for the article, thank you for pointing it out, it will be corrected.

  • Alex says:

    It would be good to provide the out-of-sample test results after 05/28/2010. Results before the in-sample may be useless because they may have been used to train an NN or genetic algorithm. It seems that after 05/28/2010 the performance is not good. Please provide results.

  • Ben Little says:

    Alex, the results are in the article (2nd equity curve).

  • Guest says:

    Tradestation can create virtual reality, if you end up walking into the trap of any kind of optimization. Unless of-course safe guards are implemented.

    Since in this exercise, you have optimized PT/SL, it helps to use “exceed limit price” setting.

    This is more so applicable for intraday trades which hinge on a small edge, trying to make a point on an average over many trades/months.

    And many times it happens so that the optimization engine will record a profit target hit, even when the price just touches it, which in reality you might never have been filled on your profit target.

    If you test this or any other of you strategy which you have a profit limit target, exceed limit price setting will give a more real picture of its performance. ( this ofcourse is not applicable for limit entries, which can never be backtested effectively to show real world performance and hence all entries if you are backtesting should be market and with appropriate slippage and commissions which I think you have done to some extent, but personally I prefer to use $30 roundtrip slippage+commisions which is on the worst case side, but it helps me to avoid looking at a pretty curve in the initial stages and something else in reality later.)

    just my 2 cents.

  • Ben Little says:

    Hi Guest, thanks for the comment. The Profit target and stop loss were not optimized in the article, the optimization tests were simply ran to make sure that the default profit target and stop loss had not been overly optimized in 2010 when the system was published. But you make a great point in the exceed limit setting. I’ve personally seen several “good” scalping systems that did not have that feature enabled, and it greatly inflated the results. You also alluded to another good point that back tested results are almost never reflections of real world results…they are simply a baseline of expectations. I heard Perry Kaufman once say that he generally only expected 50% of backtested profits in the real world. I think that is a bit on the pessimistic side, but when crafting a strategy it certainly is better to prepare for the worst-case scenario, and hope for the best.

  • Mark says:

    Interesting study. With a profit factor of 1.21, is this strategy even worth doing? I guess what I’m also asking is whether profit factor can vary like Sharpe Ratio and annualized rate of return can [vary in proportion to leverage]?

  • Ben says:

    Hi Mark, while I would be the first to say that your not going to get rich trading this strategy, it does grind out a decent profit over the long haul, even if you only use the baseline. Profit Factor can definitely be affected by several factors though, leverage included. This particular strategy is really just a good building block to either improve upon or develop your own strategy off of the core idea that we know has an edge.

  • Jens says:

    Thanks for a great post.
    I wonder if each trade always was 100k size?
    And if yes; is 0.4% profit target at all standard when it comes to morning gap targets, i thought it was more 1-2%?

  • >