BullsEdges algo trading guide: Trailing stops follow price to protect profit. Done badly they cut winners short or create fake backtest results. Here is how to design and test them.
A trailing stop moves your stop loss in the direction of the trade as price moves in your favour. It is one of the most popular features in Expert Advisors - and one of the easiest to get wrong.
BullsEdges algo trading application: Test trailing distance and update timing together; an overly tight trail can remove the large winners a trend strategy needs.
Common trailing methods
- Fixed distance: the stop stays a set number of points or dollars behind price.
- ATR trail: the distance is a multiple of ATR, adapting to volatility.
- Step trail: the stop moves in fixed steps, for example every $1 of profit moves it $1.
- R-based trail: after the trade reaches 1R, move the stop to break-even; at 2R, lock in 1R; and so on.
- Structure trail: the stop moves below each new swing low (for longs).
- Indicator trail: the stop follows a moving average, Supertrend or Parabolic SAR.
The main trade-off
Tight trails lock in profit sooner but stop you out of trends early. Wide trails let trends run but give back more profit. Neither is right in general; the strategy's purpose decides.
Tick trailing vs bar trailing
An EA can update the trail on every tick or only when a bar closes.
- Every tick: reacts instantly, but noise and spread spikes push the stop up and then hit it.
- On closed bars: less reactive, but far more robust to noise.
In our own testing on gold, moving a trail from every tick to closed one-minute bars improved results more than any other change - though it was not enough to rescue a strategy without a real edge.
The backtest trap
Trailing stops are where backtests most often lie:
- Generated ticks: if the tester invents ticks inside each bar, a tight trail behaves very differently from real ticks.
- Impossible fills: if the code moves a sell stop above the current price, the broker would reject it or fill it immediately at market. A backtest that still fills it at the stop level is inventing profit.
- Stops level: brokers require a minimum distance between price and stop. A trail tighter than that cannot actually be placed.
Always test trailing strategies on real ticks, check that every stop modification would have been accepted, and compare with a forward test.
Practical guidelines
- Start trailing only after the trade has moved a meaningful amount in your favour.
- Keep the trail distance comfortably wider than the normal spread.
- Respect the broker's minimum stops level.
- Test several distances; prefer a stable region over one perfect value.
- Check what share of profit comes from a few large winners - a tight trail often removes exactly those.
BullsEdges takeaway for algo trading
A trailing stop is a trade-off between protecting profit and letting winners run. Design it deliberately, update it on bars rather than raw ticks where you can, and test it on real tick data before you trust it.
Trading forex and gold carries a high level of risk and may not be suitable for every investor. Past performance and backtests do not guarantee future results. This article is education, not financial advice.
