Au.Tra.Sy blog - Automated trading System Au.Tra.Sy blog - Automated trading System
Slippage – Take 3: Stop-Limit Orders

Another slippage post inspired by a reader’s comment (thanks to Eventhorizon this time).

Stop-Limit Orders

The idea is to use stop-limit orders in the Donchian Channel system to avoid slippage. The stop-limit orders would prevent the system from buying/selling above/below the entry breakout level – thus reducing entry slippage.

Of course, with daily data, it is impossible to know and test whether the price sails past the breakout stop level and never pulls back (stop-limit order not executed) or whether it revisits these levels later throughout the trading session (and triggers the order execution).

However if the instrument trades again at the same level a few days later (ie. the price has retraced from the breakout), the limit order should be executed.

BlueEventHorizon ran a quick test (published on his blog) and calculated that around 85% of such breakout signals retrace in the following 5 days (excluding the day of the actual breakout).

Retrace System

However this stat alone is not a very good indicator of how well a system based on the same logic would perform: the original system has 62% losing trades – most of them would probably be “caught” by the new system, when the losers start to retrace. Of the 38% original winning trades, the system would probably only capture just over half of them (85% – 62% = 23% vs. 38%).

The system would probably suffer from missing out on these winning trades but would benefit from improved slippage for all the remaining trades.

This caught my interest and I decided to code up and test a “Donchian Retrace” system: the breakout acts as an End-of-Day signal and trigger a tentative limit order (at the breakout level) for the next five days.

The rest of the system is identical to the one tested in the original slippage post:

  • Entry breakout: 20 days
  • Exit breakout: 10 days
  • Entry Stop: 2 x 39-day exponential ATR, risking 1% of Total Equity

Results Comparison

Testing the retrace system with 0% slippage produces a CAGR of 35.51% with a MAR ratio of 0.48, whereas running the original system gave us a CAGR of 57.62% and a MAR ratio of 1.11. The percentage of winning trades goes up, as expected, for the retrace system (72% vs. 62%).

However, this is not a fair comparison, as the original Donchian system will be subject to slippage on entry, whereas the new retrace system should not. Adding 5% slippage to the original Donchian system gives a CAGR of 33.55% and MAR of 0.53:


The comparison does not look too bad for the retrace system, but it is obviosuly dependent on the real level of slippage suffered by the system.

Negative Slippage

Since the system does not perform so badly when waiting for a retrace, it might be interesting to test the impact of waiting for an even stronger retrace, past the original breakout level. By adding an “extra retrace” parameter to the system, we can decide and test by how much the retrace must overshoot the initial breakout level to enter the position. The higher the “extra retrace” parameter, the more trades are likely to be missed, but the better the execution on all the other trades.

Below are the results of a stepped simulation with different values for the extra retrace (expressed in ATR multipliers):

Stepped Parameter Summary Performance
  Retrace ATR multiplier CAGR% MAR Modified Sharpe Annual Sharpe Max Total Equity DD Longest Drawdown # Trades
0.0 35.51% 0.48 0.77 0.30 73.3% 55.1 8,369
0.1 37.36% 0.54 0.80 0.34 69.5% 54.8 8,017
0.2 37.88% 0.54 0.81 0.36 69.8% 54.9 7,747
0.3 38.88% 0.60 0.83 0.40 64.6% 49.5 7,469
0.4 42.95% 0.73 0.90 0.45 58.6% 48.1 7,244
0.5 42.48% 0.69 0.89 0.46 61.1% 49.5 7,039
0.6 45.30% 0.76 0.93 0.50 60.0% 43.1 6,827
0.7 44.51% 0.71 0.96 0.51 62.3% 43.0 6,636
0.8 39.81% 0.64 0.90 0.49 62.1% 43.1 6,436
0.9 36.27% 0.60 0.86 0.48 60.1% 27.9 6,250
1.0 32.19% 0.56 0.82 0.52 57.6% 27.2 6,014

There is a notable improvement in the system by waiting for an extra retrace, which seems to simulate some negative slippage – although more in more trades are missed as the extra retrace increases.

Note that all these simulation results are still subject to slippage assumptions. However, they should also be slightly over-pessimistic in the fact that they cannot test for same-day retraces (and simply ignore them), therefore potentially missing out more winning trades than in reality (all those trades that retrace on the day but not in the next 5 days).

Limit orders could be another tool to reduce slippage. After all, if they were recommended to the Turtle traders, they must be a useful tool…

Related Posts with Thumbnails

arrow7 Responses

  1. julien
    77 mos, 1 wk ago


    i’d like to test this on some stocks but i am not sure i got the system right:

    entry 20 days means that you go long if todays high is larger than the last 20 highs. (short respec with lows)

    exit 10 days means that if you have a long position and the low is lower that the last 10 ones, you cover your short.

    2 ATR means that you have a stop loss.
    I don’t get what a 39 days exponential ATR is.
    39 days seems to indicat that you do an everage of the last 39 days ATR (à la classic moving average) but exponential means more like an exponenatial weigthed average but then 39 does not makes sense, you need some alpha parameter, right?

  2. 77 mos, 1 wk ago

    correct – an exponential moving average is normally characterised with a smoothing factor however there is a “standard” conversion from the number of days to a smoothing constant:
    alpha = s = 2 / ( n + 1)
    where n = equivalent number of days in standard moving average

    this is discussed in Perry Kaufman’s book New Trading Systems and Methods (pg 278 in my edition – Time-Based Trend Calculations chapter). The conversion was devised to make both standard and exponential MA more “relatable” in their length parameter.

    Note that this is similar but different to the Wilder Moving Average which uses alpha = 1 / N and so to convert Wilder ATR to Exponential ATR and vice-versa:
    Normal EMA Days = (Wilder Days x 2) – 1
    Wilder Days = (Normal EMA Days + 1) / 2

  3. julien
    77 mos, 1 wk ago

    ok i get it.

    And this ATR is used as stop loss once the position is entered, exact?

    Then the retracement that you use is like: say ATR is 2 and my close of yesterday was say 20 triggering a long trade.
    The next day you put a limit buy at price 20-0.5*2=19 for a retracement of 0.5.
    If you see the low of the day lower than 19, you assumed your order would have been filled at 19.

    so it is sort of mixing trend following and mean reversion around that trend to improve your entry points.

  4. Pumpernickel
    77 mos, 1 wk ago

    “When in doubt, do half.” -R.Dennis

    Put on half your position using the normal Stop order, and accept the slippage. Put on the other half of your position using the “wait for a retracement” limit order scheme.

    If the limit order is filled, you get a lower average cost. If the limit order isn’t filled, at least you’ve got a half size position in a trade that rocketed straight to the moon.

    You could even treat the allocation percentage as an optimizable parameter: X% to (Stop order entry), 100-X% to (Retracement Limit order entry). Although that might be a little excessive.

  5. Motomoto
    77 mos, 1 wk ago

    not to put too much of a dampner on things….:)
    These amendments go way beyond slippage for me. They completely change the nature of the system.
    For me slippage is simply the deviation in PL/results from actual trading verses theoretical results. Thus in measuring it your are merely giving yourself a margin of error in a system.

    Using entry limit orders does not necessarily reduce slippage, it simply means you either do or don’t get set for an entry.
    Also more importantly is what do you do for exits….. this slippage to me is more important…. or are you likely to put a limit order on to an exit? Ultimately slippage is only measurable and relevant when actually trading to see if you can improve, and ideally better a theoretical system.

  6. 77 mos, 1 wk ago

    Agree with you.. The change to the system effectively introduces a “short-term mean-reversion” component to a longer-term trend following system, the idea being to explore a slightly different system, which should be subject to less slippage (because it uses limit orders and does not trade in the direction of the current momentum). Of course this all relies on assumptions on slippage – which can only be verified by checking real vs. theoritical results…

    Re: exits, I would not “dare” using limit orders (somehow loss of opportunity on entry seems more palatable than potential large loss on exit, ie. if the exit breakout over-shoots the exit limit price) – although maybe a mixed approach with an ideal limit price and a “hard and fast” SL at a worse but acceptable level could be an idea

  7. Motomoto
    77 mos, 1 wk ago

    Yes – one thing that I think a lot of traders (systemised or discretionary ) miss is the opportunity to further divide up entry and exit rules into the subsections of setup, context, trigger and actual exit levels.
    eg; for an exit, you might say, a stop setup and trigger might go off whereby the system is alerted to exit a position. After this the system will exit at a level that actually may be some sort of retracement level. However there is also a worst case stop level of price X should no retracement occur.
    This sort of flies a little against many LTTF systems, however who is to say whats right and wrong, so long as its consistent and makes money!

Leave A Comment