Designing Forex Systems that Work with a Trailing Stop

When I started to create algorithmic trading systems the idea of the trailing stop (TL) appeared as both interesting and logical. A trailing stop regularly works by moving a trade’s stop-loss (SL) to break-even after price has moved a given number of pips in the trader’s favor, moving it further into profit so that the SL is always a given number of pips behind the most positive gain achieved for that position. For example if you’re using a trailing stop of 50 pips, your SL would move to break even as your profit reached 50 pips and it would always hold 50 pips behind the highest level of profit achieved. If your position moved to 150 pips of profit, your SL would be at 100 pips of profit, ensuring that you don’t give back that amount if the market retraces. At first glance the idea of a TL sounds very good, however I didn’t find it as good in practice.

My first problem with the idea of the TL came when I examined the effect of a TL on the strategies that I had created. The TL generally had negative effects on the overall profit to drawdown characteristics of systems. The problem was generated because the TL refused to give way to volatility expansions once price moved in your favor, so it was very easy for price to whipsaw on expanding volatility and takeout a position. For this reason I forgot the overall idea of the TL as whenever I tried this type of position management, my trading systems came up worse than before. I always tried a TL with all the systems I created to see the effect a TL had and there wasn’t a single time when the traditional TL worked positively. It seemed as if the traditional TL was a faulted idea that wasn’t very suited to algorithmic trading, a psychological soothing mechanism that was always a sub-optimal choice compared to other position management mechanisms.

1-3-2014 10-00-14 AM

The creation and development of Kantu has brought my interest again towards the TL as I am no longer restricted by manual system creation in order to test new position management ideas. With Kantu I have been able to perform a very interesting experiment that I couldn’t before: Instead of creating a system and then trying a trailing stop, I could generate systems that worked with trailing stops and see what they looked like. This means that instead of trying to “force” a system to work with a trailing stop it wasn’t designed with, I would try price pattern combinations that worked with trailing stops and see what I would get. Interestingly, my first tries with the traditional trailing stop lead me to absolutely no profitable systems. Supporting my previous findings, it seemed as if the traditional trailing stop wasn’t suitable for the building of algorithmic trading systems.

I then coded a new type of trailing stop  into Kantu that allowed for volatility expansions after the trailing stop was initially set, allowing the trade to give back some profit if volatility decided to expand and retrace a bit, but never giving back enough as to turn a winning trade into a loser (meaning that break-even was always the worst case after the TL was triggered). This new mechanism generated some really interesting results, with trading strategies that comply with many of the characteristics that I now seek within algorithmic trading systems.

1-3-2014 10-02-18 AM

Systems generated using this type of trailing stop really benefited from this mechanism. Removing the trailing stop generally deteriorated their trading characteristics. This means that I wasn’t simply forcing what would have been better systems without it to use a TL but I was actually getting better systems because of its use (see non-compounding comparison above). Additionally I found that this TL mechanisms led to profitable systems across all FX major pairs, something that was quite difficult to achieve when building 1H systems using Kantu.  The trailing stop also significantly reduced the percentage of losing trades within the systems and reduced the time they remained within the market. Additionally the systems now showed a new feature in their distribution of returns that shows how a significant percentage of trades are stopped at or near break-even thanks to this mechanism. Most of these trades would have otherwise turned into losers, as they retraced despite of the additional way given by the volatility expansion of the TL.

Another interesting feature of these systems designed around a TL is their mathematical expectancy (ME). I quickly saw that systems created using a TL tended to have a very nicely distributed ME curve. The net ME (Maximum Favorable Excursion – Maximum Unfavorable Excursion) tended to show nicely overlapping positive regions for short/long trades (as showed in the image herein) that depict a favorable ME on trade open for a wide variety of bar numbers. This is a fundamental characteristic of successful trading strategies. The design of systems around a TL brings this as a natural consequence, as systems with low ME values cannot benefit from the TL as they tend to show some degree of mean reversion. Systems with highly specific entries and high ME values tend to follow their initial signal direction, meaning that only these systems can be successful using a TL.

1-3-2014 10-13-42 AM

The design of systems around the idea of a TL is therefore good for the creation of strategies that fulfill characteristics without which a TL cannot be successful. Not only are these systems fundamentally easier to trade from a psychological perspective – as they avoid some winners turning into losers – but they also highlight some statistical characteristics that are desired for strategies that are expected to yield positive results under unseen market conditions. Interestingly these strategies also exhibit some of the characteristics needed for fast failure detection, such as high winning rates (55-60%) with sometimes even above 1 reward to risk ratios (thanks to their high ME values). I therefore think now that you should not build a trading system and then design a TL for it, but you should design a TL and then seek systems that fit into that model successfully — something Kantu is really good at.

If you would like to learn more about Kantu and how you too can use this program for the algorithmic creation of trading strategies  please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)

You can skip to the end and leave a response. Pinging is currently not allowed.

3 Responses to “Designing Forex Systems that Work with a Trailing Stop”

  1. Fd says:

    Hi Daniel,

    interesting twist :) It is similar to a methodology I proposed as a new Asirikuy member. My proposal was to first search quote data for segments with clear directionality and a good risk to reward ratio and then, in a second step to try to find criteria which could serve as entry triggers with good precision. Because we would first look at desirable results and then how to achieve them (the trigger) it is completely reverse to how you would analyze things usually: you have a suspect that something could serve as an entry trigger and through backtesting you verify whether you were right. While the latter approach is most successful when done by experienced human traders, it seems not to be overly well suited when used in automatical strategy generation.

    Just to make your finding about the TL more general: if we have a model that describes a set of favorable movements we can construct a matching verification procedure (read: exit criterion). Your current TL implementation is just 1 model, but I guess we can find more and better ones. I also guess that using this “reverse” methodology we will end up with strategies which have very little exposure (measured as “time in market”). Good finding, I think we are on the right track. :)

    Best regards,
    Fd

  2. Bob says:

    “I therefore think now that you should not build a trading system and then design a TL for it, but you should design a TL and then seek systems that fit into that model successfully — something Kantu is really good at.”

    Interesting but how can you avoid curve-fitting as TL is basically a curve-fitting exit method?

    • admin says:

      Hi Bob,

      You’re actually fitting to a very specific case here. You’re saying “I want a trading method that works under this type of exit mechanism”. I don’t like the word “curve-fitting” a lot because it seems to include an assumption related with future performance. If you’re asking whether the model has a higher probability to fail in the future due to this “fitting to a particular exit case” I would say that my tests don’t show a higher like-hood of out-of-sample failure (at least historically) against systems without this exit assumption. However my tests do show an easier ability to detect failure due to the statistical nature of the generated systems.

      I would say that – at least historically – the introduction of a TL hasn’t made systems more prone to failure under unknown conditions or more prone to overestimate profitability compared to systems generated without a TL. I hope this answers your question :o)

      Best Regards,

      Daniel

Leave a Reply

Subscribe to RSS Feed Follow me on Twitter!
Show Buttons
Hide Buttons