Trailing Stop and Auto-Breakeven
Trailing stop management and auto-breakeven for open positions: how each feature is configured, how they interact, and how to diagnose unexpected behavior.
Last updated: 2026-10-08
A trailing stop moves your stop loss behind price as a trade goes your way, so you keep more of the profit if the market turns. Auto-breakeven moves the stop to your entry price once the trade is far enough in profit, so a winning trade can't turn into a loss. You can add either one to the alert that opens a trade, or send trail and breakeven later to manage a position that's already open, as shown in Commands.
Trailing stop#
A trailing stop keeps your stop loss a set distance behind the best price the trade has reached. It only ever moves in your favor, so when price pulls back, the stop stays where it is. You choose the distance in one of three ways:
distance_pips=20keeps the stop 20 pips behind price.distance_pct=0.5keeps it 0.5% of the entry price behind, which works the same way across symbols with very different prices.distance_atr=1.5keeps it 1.5 times the Average True Range behind, so the distance widens when the market is volatile and narrows when it's quiet.
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,distance_pips=20,trail_step=5
By default, trailing starts once the trade is in profit by the trail distance. To start it later, add a trigger with trail_trigger in pips, trail_trigger_pct as a percentage, or trail_trigger_price as an exact level. With a 30-pip trigger and a 20-pip distance, the stop stays put until the trade is 30 pips up and then follows 20 pips behind.
Step size#
Without a step, the stop moves on every favorable tick, which in a fast market can mean hundreds of changes a minute and some brokers start refusing them. A step makes the stop wait until it can move a minimum amount at a time, using trail_step in pips with distance_pips or trail_pct_step with distance_pct.
For example, on a EURUSD buy at 1.10000 with distance_pips=20 and trail_step=5, the stop moves to 1.10000 when price reaches 1.10200. Price then has to reach 1.10250 before the stop moves again, to 1.10050. The stop therefore trails a little further back than the distance alone, by up to one step, in exchange for far fewer changes at the broker.
A step of 5 to 10 pips suits most currency pairs and metals, while slow instruments can leave it out for the closest tracking. A percentage step larger than its distance is capped at the distance, and trail_step must be above zero.
ATR trailing#
In ATR mode, PineHook measures the ATR over trail_atr_period candles (14 by default) on trail_atr_timeframe, which falls back to your saved timeframe, or H1 if none is saved. The distance only updates when a candle closes, so the forming candle doesn't change it, and the step is always 10% of the current distance. A wider ATR lets the stop follow from further back, but the stop itself never moves backward.
Auto-breakeven#
Auto-breakeven waits until the trade is in profit by your trigger, then moves the stop to the entry price once and switches itself off. Set the trigger with be_trigger_pips, be_trigger_pct or be_trigger_price:
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,tp_pips=100,be_trigger_pips=30,be_offset_pips=5
The offset decides where the stop lands. Without one, it goes to the exact entry price. A positive offset, such as be_offset_pips=5, places it 5 pips into profit, while a negative one places it slightly on the losing side of entry, which some traders use to avoid being stopped out by a small pullback right after breakeven.
A trigger of 0 means no auto-breakeven at all. To move an open position to breakeven straight away, send the standalone breakeven command instead.
Using both together#
You can set a trailing stop and auto-breakeven on the same position, and they both wait until one of them acts. Whichever acts first removes the other, so they never fight over the stop, and it also releases any multi-target stop-loss levels that haven't fired yet. If both would act at about the same price, within one pip, neither is set up, and the alert's response includes a warning saying so.
To remove one without closing the trade, send notrail or nobreakeven for the symbol, and the stop stays where it is. To change a trail, send a new trail alert, which replaces the old settings.
Platform differences#
On MT5, the EA runs both features on your terminal and saves them to disk, so they continue after a restart as long as the position is still open. It moves the stop only while it's running, though, so the broker keeps the last stop it was given if the terminal goes offline.
On cTrader, a trailing stop without a step uses cTrader's own trailing at the broker, which keeps working even while PineHook is disconnected. A stop with trail_step or trail_pct_step is managed by PineHook instead, so it pauses while PineHook is disconnected, and the broker keeps the last stop. Breakeven triggers and ATR distance updates also depend on PineHook's connection.
Good to know#
- Editing the stop by hand doesn't turn these features off. The next trailing move or the breakeven trigger overrides your manual change, so send
notrailornobreakevenfirst if you want to manage the stop yourself. - Broker stop limits can delay a move. If the new stop would sit closer to price than the broker allows, PineHook skips that move and tries again as price moves on, so a stop that never moves usually means the trail distance is smaller than the broker's minimum.
- Triggers use the live bid or ask. A breakeven trigger can look reached on the chart's mid price and still not be crossed by the price that counts.
- They end with the position. Neither feature carries over to the next trade.
If a trailing or breakeven alert is rejected, Alert error messages explains each message.