Improving The Simple Gap Strategy Part 3

In the last article in this series, Improving The Simple Gap Strategy Part 2, I tested two filters on the OOS sample data. The first filter was a day-of-week (DOW) filter which did not produce decent results.  The second filter, Gap Size, did show promising results. Reviewing my notes from years ago, I also discovered that the size of the gap will play an important factor in the success of many gap strategies. So, this was not a surprise. It was something I should have recalled, but it was worth testing again. In this article I’m going to test a another idea. At the conclusion of this article you will find the free EasyLanguage code for this strategy.

Testing Environment

Because I’m currently testing and developing this trading model I’m going to be using my in-sample portion only. Before getting into the details of the results, let me say this: all the tests within this article are going to use the following assumptions:

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

Previous Day’s Price Action

The idea is to determine if the previous day’s direction has any impact on the baseline system. That is, does the performance of the Simple Gap Strategy depend upon if yesterday was a down day or an up day? This will be simple to test to perform. I will create a flag indicating if yesterday was an up day (Close <= Open) or a down day (Close > Open). From there we can test each of the two conditions by only taking trades when the previous day was a up-day. Then I’ll run the test again only taking trades when the previous day was a down-day.

Below is a table of the results. The “Up Day” column displays the results if trades are only taken if yesterday’s close was higher than its open. The “Down Day” displays the results if trades are only taken if yesterday’s close was lower than its open.

Simple Gap Previous Day Filter Results

Notice the number of trades in the “Up Day” column (621) added to the number of trades in the “Down Day” column (562) add up to the baseline total of 1,183. So, we have a nice clean divide with all trades accounted for.

The “Up Day” column shows a severe decrease in performance. If yesterday’s price action produces an up-day, it sure looks like that this gap fading strategy will probably not work out very well. On the other hand, if yesterday was a down-day, this gap fading strategy does rather well. We produce about the same amount of profit with about half the trades. As you can see, by looking at the “Up Day” column, we eliminated some very unproductive trades as we are taking only 562 trades. This produces a significantly better profit factor and average profit per trade.

The next question you might be asking yourself is this, is there a significant difference between long and shorts? That’s a good question. The results in the table above combine both long and shorts. Recall, we are taking both long and short trades during each of the two tests. Thus, it’s possible that shorting during the “Up Day” filter is doing really well, but the overall results are being destroyed by poor performance on the long side. Looking at long trades and short trades individually should be done. Looking at the TradeStation performance report I can see both long and short trades during the “Up Day” filter are horrible.

As for the “Down Day” filter both long and short trades produce decent results. I’ve separated the long from short trades and generated two equity graphs to demonstrate the difference. First equity graph, below, is the short trades only during “Down Day” filter.

Gap_Short_Only_DownDays

Next is long trades only during the “Down Day” filter.

Gap_Long_Only_UpDays

 

If you combine the long and shorts you get the following equity graph.

Gap_EQ_Curve_DownDay_Filter

Overall, there is a lot of choppiness in the early few years, but this is nothing different from the original strategy.

Conclusion

In summary the filter based upon the previous day’s price action does appear to help improve the overall performance so, I think we can keep this filter to test on the OOS. This means we now have two filters, the Gap Size and the Previous Day. I won’t combine these filters and test them on the OOS yet. There are still other ideas to test which will appear in another article. Some of the ideas include:

  • What about dynamic exit as a percentage of the gap size?
  • What about a dynamic stop as a percentage of the gap size?
  • What about holding a trade through the end of the day?
  • What about exiting a trade after so many consecutive winning bars?

Downloads

The free EasyLanguage code for this strategy is below. There is also a text version of the code which can be used to help convert this strategy to another platform. For the TradeStation WorkSpace please download the file from one of the previous articles. You’ll find links to the previous articles below.

Gap Strategy With Previous Day Filter (TradeStation ELD)
Gap Strategy With Previous Day Filter (Text file)

Other Article In This Series

About the Author Jeff Swanson

Jeff is the founder of System Trader Success - a website and mission to empowering the retail trader with the proper knowledge and tools to become a profitable trader the world of quantitative/automated trading.

follow me on:

Leave a Comment:

14 comments
Add Your Reply