July 27

2 comments

Improving The Simple Gap Strategy Part 4

By Jeff Swanson

July 27, 2015

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

In the last article of this series, Improving The Simple Gap Strategy Part 3, I tested a price-based filter on the in-sample data. This filter was based upon the price action of the previous trading day. During this test we discovered that if the previous trading day was a down-day we could open a Simple Gap trade today. On the other hand, if the previous trading day was an up-day we should not take our Simple Gap trade today.

In this article I’m going to test dynamic stops and targets. Currently the strategy uses a fixed dollar amount for both the profit target and stop loss. I’m going to use the size of the gap as a factor in determining both the profit target and stop loss.

Testing Environment

Because I’m currently testing and developing this trading model I’m going to use my in-sample portion only. Before getting into the details of the results, let me say this: 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
  • One contract was traded per signal
  • The P&L is not accumulated
  • $20 was deducted per round-trip for slippage and commissions

Testing A Dynamic Profit Target

First, I’m going to test a dynamic target based upon the size of the gap. Before getting started I will revert back to our baseline which in this case is our Simple Gap strategy without the filters we have been testing in previous articles. At this stage of my testing I don’t like to combine different filters. I much prefer to measure the individual impact each filter has on the system.

The next thing I will do is comment out our hard stop. Why? Once again I want to measure the effect of our static profit target vs our new dynamic profit target. This means commenting out the hard stop in our baseline as well. With the stops disabled we will be directly measuring the static profit target vs our dynamic profit target without other variables interfering. Again, this technique is simply a way to isolate a key variable we are attempting to quantify. In this case, our stop loss method.

Now that I’m back to my baseline code, I’m going to create a new input value called prftTgFactor which will hold our profit target factor. This will be used to multiply with the gap size. A value of 1 for the prftTgFactor means we have a profit target equal to the size of the gap. A prftTgFactor of .5 means we have a profit target 1/2 the gap size.

With this new input I’ll use TradeStation’s optimization feature to test a range of targetFactors. I’m going to test a range between .1 and 2.0. This will generate 20 different tests.

In the above bar graph we can see all combinations produced negative return as each bar is below zero (left axis). This tells me a dynamic profit target, without a stop, is not enough to make this system break even. Restricting losses appears to be a critical component to push the strategy into profitability. Notice how there is a valley that’s right around the 1.0 value on the x-axis. This produces the “best” results and represents a profit target equal to the gap size.

Below is the equity graph of the baseline system with the profit target ($200) and stop loss removed.

Looking at the baseline results we see it makes profit. Again the baseline has no stop. Since the baseline makes a profit, we know a static profit target is responsible for the gains.  There seems to be something to the idea of taking a $200 profit and calling it a day as opposed to taking a profit based upon the gap size – at least given the study we have performed here.

This is not to say a dynamic profit target may not work with some gap strategies. Far from it. This is just telling us there is more going on here than meets the eye, and a dynamic profit target applied equally to all gap sizes does not appear to be a quick fix to profits. Yet, we still have more testing to do.

Testing A Dynamic Stop Loss

For the next test I’ll comment out our profit target for both the baseline and the new dynamic stop strategy I’m working on. Why? Once again I want to measure the effect of our static stop loss vs our new dynamic stop loss. To do this, I’m going to create a new input value called StopFactor which will hold our stop loss factor. This will be used to multiply with the gap size. A value of 1 for the StopFactor means we have a stop loss equal to the size of the gap. A StopFactor of .5 will mean we have a stop loss 1/2 the gap size.

With this new input I’ll use TradeStation’s optimization feature to test a range of targetFactors. I’m going to test a range between .1 and 2.0. This will generate 20 different tests.

There appears to be very little change when modifying the stop loss based upon the gap size. This is different than our profit target optimization test above where we can clearly see an optimal range. Here, not so much. All the values tested produced negative returns. This hints to me that given our current strategy, a dynamic stop may not offer much value.

For reference, below is the equity graph of the baseline system with the static stop only, no profit target.

Once again the baseline with the static stop loss makes a profit.  So what does this mean? Maybe profit targets will have more of an impact than a stop. Maybe having a static stop and a dynamic target would be a more powerful combination. However, it really appears that neither a dynamic profit target or a dynamic stop based upon the gap size will provide much of an improvement with our baseline system. We’ll test that next.

Combining Both Dynamic Stop and Target

After studying both the dynamic profit target and stop loss individually, I decided to combine them. I created two input values. The first was prftTgFactor. The second was StopFactor. I then used TradeStation’s optimization feature to optimize these two parameters together. After letting the optimization run there was no worthwhile profitable combination. The vast majority of the tests produced negative results. There was no stable range, there was no improvement. Far from it, in fact!

Conclusion

In the end it appears using a dynamic stop and/or a dynamic profit target based upon the size of the gap does not improve performance given the Simple Gap strategy. While dynamic stops and targets may work with other gap strategies, this particular strategy does much better with static values for both the stop loss and profit target.

In the next article of this series I’m tempted to combine our successful filters and see what we get.

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.

  • Quick question. you said:

    “Because I’m currently testing and developing this trading model I’m going to use my out-of-sample portion only.”

    Did you mean to say you were testing on in-sample portion only? If it’s not a typo, I’m curious as to why you’re using the OOS portion. Thanks!

    P.S. keep up the good work. 🙂

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

    Learn To Code & Build Strategies
    Using EasyLanguage. 

    >