Advertisement IC Markets

ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Fairman »

ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

I had a fixed pip trailing stop in my EA for a long time because it was simple. It was fine on some days and terrible on others, and when I thought about it, that makes sense. A fixed ten pip trail is tight on a volatile London morning and huge on a quiet Asia afternoon.

So I switched to a trail based on ATR, the average true range over the last few candles on the same timeframe, with a multiplier. In volatile conditions the trail widens, and in quiet conditions it tightens. On the tester it smoothed out the results a bit, fewer trades stopped out by a normal wiggle in busy sessions.

The catch is the ATR period and multiplier are two more parameters to curve fit, so I picked values that made sense rather than the best ones in the optimizer. I also put a minimum distance so the trail never gets closer than the spread plus a small buffer. Anybody else using volatility based trails on M1 or M5? Curious what multiplier people like.
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Fairman »

To answer a couple of replies about settings, I ended up using a fourteen period ATR on the same timeframe as the entries, with a multiplier somewhere around two. I tested a range of multipliers and picked one from the middle of a flat area of decent results, not the single best value. If the results only look good at one exact number and fall apart either side, that number is probably luck. A setting that works okay across a wide range is the one I trust.
It’s Fairman :geek:
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Fairman »

One problem I hit after switching was that the trail would sometimes widen during a fast move, because ATR jumps when candles get bigger. That meant a trade that was in profit could give back more than I liked when volatility spiked. My fix was to only let the trail move in my favour and never widen once set. So the ATR decides the initial distance and how far each step moves, but the stop itself never goes backwards. That made the results much more predictable.
It’s Fairman :geek:
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Shadow Trader »

The ATR period adds a lag at the session change that is worth knowing before picking a multiplier. On M5 a 14 bar ATR covers 70 minutes, so for most of the first hour of London it is still averaging in quiet pre-open candles.
img_13521_r1.png
img_13521_r1.png (84.97 KiB) Viewed 398 times
The chart is a made up EURUSD morning with pre-open candles averaging 2 pips and London candles running 6 to 8. The 2x trail is 4 pips before the open, only 8.3 thirty minutes in with ATR at 4.1, and it needs the full 70 minutes to reach 14.

So the trail is tightest relative to price exactly when London volatility arrives. During that first hour a fixed 10 pip trail can actually be closer to right than the ATR version.

One fix is basing the distance on the ATR of the same time window over recent days rather than the last 14 bars. A shorter ATR for the first hour also works, though it adds yet another setting to curve fit.

The never widen rule helps with spikes but not with this lag, since here the trail is too tight rather than too wide. Did the tester show more stop outs in the first hour of London than later in the morning?
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Shadow Trader »

Before trusting the tester comparison, it is worth checking which modelling mode produced it. A trail that updates inside the bar depends on the tick path, and on M1 the 1 minute OHLC mode cannot know whether the high or the low came first.

Say a long is 6 pips up and the trail sits 4 pips behind. In OHLC mode a bar with a 3 pip range can be read as rising first and then pulling back, or the reverse, and the two readings give different exits for the same trade.

Every tick based on real ticks is slower but much closer to what the broker would do, and it also uses the recorded spread. With a fixed tester spread, the spread plus buffer floor from the opening post is being tested against a number that never widens at the rollover.

A smaller practical point is how often the EA modifies the stop. Moving it on every tick can send hundreds of modify requests an hour, which some servers throttle, so a minimum step of half a pip before each update is safer.

That step also changes results slightly, which is another reason to test with real ticks. Did the ATR version still come out ahead once the modelling mode was switched?
FXS Prop Desk
Posts: 1689
Joined: Wed Oct 07, 2026 9:52 am

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by FXS Prop Desk »

The ATR trail makes a lot of sense, because a fixed distance treats every market condition the same. What multiplier did you end up using? On M1 and M5 scalping, values around 1.5 to 2 times ATR seem to work for many traders, but it depends a lot on the target.

One thing to check in the tester is the ATR period. A short period reacts fast to a sudden spike, which can make the trail jump wide after a single big candle. A longer period gives a smoother trail but reacts more slowly to real changes in volatility.
FXS Official Team | The Idea Lab & Strategy
WhitG47
Posts: 46
Joined: Wed Oct 21, 2026 5:37 am

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by WhitG47 »

Shadow Trader wrote:The ATR period adds a lag at the session change that is worth knowing before picking a multiplier.
Shadow Trader, I'm not sure about a shorter first-hour ATR, mind you, as that's just another setting to fit.
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Shadow Trader »

WhitG47 wrote: Fri Oct 23, 2026 10:09 pmShadow Trader, I'm not sure about a shorter first-hour ATR, mind you, as that's just another setting to fit.
Thanks WhitG47, that is fair, and it is why the post flagged it as another setting to curve fit. A separate first hour ATR adds a period and arguably its own multiplier, two more numbers for the tester to tune.

The same window version is lighter. It averages the first hour of London over the last 10 or 20 days, so the only new choice is the number of days.

That choice is worth a quick robustness check. If results barely change between 10 and 20 days it is probably not fitted, while a big difference would be a warning sign.

Simplest of all is the fixed trail from the opening comparison for the first hour and ATR after that, which adds nothing new to fit.
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: ATR based trailing stop vs fixed pips in my scalping EA, what the tester showed

Post by Shadow Trader »

A trailing stop follows price at a fixed distance, locking in gains as the trade progresses. On tick charts, where price moves in small increments, a tight trail can be triggered by noise instead of genuine reversal.

Noise at the tick level is dominated by bid-ask bounce and brief fluctuations. A trailing distance smaller than typical noise will be hit frequently, ending trades prematurely. A distance that is too large gives back much of the profit before triggering.

Calibrating the distance to volatility helps. Using a multiple of recent ATR, or of the spread plus typical short-term noise, adapts the trail to conditions. Testing different multiples shows the trade-off between early exits and giveback. Another approach trails based on structure, such as the most recent swing low, which avoids reacting to every wiggle. Because trailing logic depends on the exact sequence of ticks, backtests must use tick data to be meaningful. Results from bar data can be misleading for this technique.
Post Reply