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.
Overview#
Trailing stop and auto-breakeven are two automated stop-loss management tools that run on your MT5 terminal while a position is open.
A trailing stop moves the stop-loss progressively in the direction of a profitable trade, keeping it a configured distance behind the best price reached. The stop only moves forward. It never steps back. A trailing stop can be configured as a fixed pip distance, a percentage of the entry price, or a volatility-based distance derived from the Average True Range (ATR) indicator.
Auto-breakeven moves the stop-loss to the position's entry price (optionally locking in a small buffer of profit) once price has traveled a specified distance in your favor. It fires once and then removes itself.
Both monitors can be active on the same position simultaneously. If both are registered, they coexist until one fires, at which point the other is removed automatically to prevent conflicting modifications.
How It Works#
Trailing Stop#
When you send a signal with trailing stop parameters, the EA registers a per-position monitor at the time the trade opens. On every price tick the EA checks whether the configured trigger condition is met. If it is, the EA calculates the proposed new stop-loss level and submits a broker modification only when two conditions are both true: the proposed stop is more favorable than the current stop, and the move is at least the configured step size. If either condition fails, the EA waits for the next tick.
Sub-flow: pips-based trailing#
You set the trail distance in pips. The EA keeps the stop-loss that many pips behind the current best bid (for buy positions) or ask (for sell positions). An optional step parameter prevents the stop from chasing every micro-movement. The stop only advances when price has moved at least that many pips beyond the current stop plus the trail distance.
Sub-flow: percentage-based trailing#
You set the trail distance as a percentage of the entry price. The mechanics are identical to pips mode, but the distance and step are expressed as a fraction of the opening price, making them instrument-agnostic across different symbols and account currencies. If you specify a step that exceeds the distance, the step is automatically capped to the distance value.
Sub-flow: ATR-based trailing#
You set the trail distance as a multiple of the Average True Range indicator, with a configurable lookback period and timeframe. The EA initializes the ATR indicator once at registration and recalculates the trail distance on each tick as the indicator value changes, so the stop widens during volatile conditions and tightens when markets calm. The step size in ATR mode is set automatically to 10% of the current trailing distance (i.e. 10% of ATR value x your distance_atr multiplier) and cannot be configured. On the first one or two ticks after position open, the indicator may not yet have produced a reading; the EA skips those ticks and resumes automatically once the indicator is ready.
Sub-flow: trail trigger#
By default, trailing activates as soon as the position's profit reaches the trail distance. You can delay activation by specifying a trigger: a pip distance from entry, a percentage of entry price, or an exact price level. The EA waits until price crosses the trigger price before it starts moving the stop.
Sub-flow: step size#
The step parameter controls the minimum distance the stop-loss must advance before the EA submits a new modification to the broker. Without a step, the EA would attempt an order modification on every price tick where the current price has improved, which in an actively moving market can be hundreds of times per minute. Most brokers throttle high-frequency stop modifications, and some will temporarily reject them entirely. The step prevents this by batching movements: the EA waits until the proposed stop-loss has improved by at least the configured step before it sends anything.
The parameter name depends on the trailing mode:
- Pips mode:
trail_step(in pips) - Percentage mode:
trail_pct_step(as a percentage of entry price) - ATR mode: not configurable; the EA uses 10% of the current trailing distance (i.e. 10% of ATR value x your distance_atr multiplier) automatically
trail_step must be a positive number. Zero and negative values are rejected at signal validation. Omitting the parameter entirely is valid and produces continuous trailing on every tick, appropriate for instruments with slow or infrequent price movements, but not recommended for high-frequency instruments during fast markets.
How the step is evaluated#
After each SL update, the EA compares the proposed new stop to the current stop. If the difference is less than the step size, it waits. The stop only advances once the accumulated movement since the last update reaches or exceeds the step threshold. The stop never moves backward regardless of how ATR or price fluctuates.
Worked example (pips mode)#
Setup: EURUSD buy, entry = 1.10000, distance_pips=20, trail_step=5
| Price (bid) | Proposed SL | Move from current SL | Action |
|---|---|---|---|
| 1.10200 | 1.10000 | Trail just activated | SL set to 1.10000 |
| 1.10215 | 1.10015 | +1.5 pips | Below step threshold, no update |
| 1.10230 | 1.10030 | +3 pips | Below step threshold, no update |
| 1.10250 | 1.10050 | +5 pips | Meets step, SL updates to 1.10050 |
| 1.10265 | 1.10065 | +1.5 pips | Below step threshold, no update |
| 1.10300 | 1.10100 | +5 pips | Meets step, SL updates to 1.10100 |
Without trail_step, every one of those ticks would trigger a broker modification. With trail_step=5, two modifications achieve the same end result with far less broker traffic.
Worked example (percentage mode)#
Setup: XAUUSD buy, entry = 2000.00, distance_pct=0.5, trail_pct_step=0.1
- Step threshold in price terms: 2000.00 × 0.1% = 2.00 (two dollars per step)
- Trail activates when price reaches 2010.00 (entry + 0.5%)
- At activation, SL = 2010.00 − 10.00 = 2000.00
- Price at 2011.50: proposed SL = 2001.50 (move of $1.50, below the $2.00 step); no update
- Price at 2012.00: proposed SL = 2002.00 (move of $2.00, meets step); SL updates to 2002.00
- This means on a $2000 gold position, the stop advances every $2 of price improvement rather than every tick
Choosing a step value#
| Step value | Effect | When to use |
|---|---|---|
| Omitted | SL updates on every favorable tick | Slow-moving instruments, maximum trailing precision |
| Small (1-3 pips) | Very frequent updates, minor broker traffic reduction | Actively traded FX pairs where spread is tight |
| Medium (5-10 pips) | Balanced; stops every few cents, avoids throttling | Most common choice for standard FX and metals |
| Large (15+ pips) | Infrequent updates, "chunky" step behavior; stop may fall noticeably behind during a fast move | Wide-spread instruments, very volatile conditions |
A step that is larger than the trail distance is invalid only for percentage mode, where it is automatically capped to the distance value. In pips mode, a step larger than the distance is technically accepted but produces no movement until price advances by step pips, effectively a delayed trail with jumpy behavior.
What you'll see#
With a well-sized step, the stop-loss moves in discrete jumps rather than continuously. The stop will always be within distance + step pips of the best price reached, not within distance pips exactly. If you notice the stop appears to lag slightly by more than the trail distance, you're usually observing the step floor at work. This is correct behavior. If tighter tracking is needed, reducing the step or omitting it entirely will increase precision at the cost of more frequent broker modifications.
Auto-Breakeven#
When you send a signal with breakeven parameters, the EA registers a separate per-position monitor. On every price tick the EA checks whether price has crossed the configured trigger threshold. When it has, the EA calculates the breakeven stop-loss level (entry price plus any offset), submits the modification to the broker, and immediately removes the monitor. Auto-breakeven is one-shot; it never fires twice.
Sub-flow: breakeven trigger#
You define the profit threshold at which the stop moves to breakeven. This can be expressed as pips of profit, a percentage of entry price, or an exact price level. Setting be_trigger_pips, be_trigger_pct, or be_trigger_price to 0 is treated as no trigger specified: no auto-breakeven monitor is registered. To move to breakeven immediately after the position opens, use a very small positive trigger (e.g. be_trigger_pips=1), or use the standalone breakeven command to move an in-profit position to breakeven at once.
Sub-flow: breakeven offset#
The offset controls where the stop-loss lands after the trigger fires. With no offset specified, the stop moves to the exact entry price. A positive offset (in pips or percent) places the stop above entry on a buy (or below entry on a sell), locking in a small amount of profit. A negative offset places the stop slightly on the loss side of entry. Some traders use this to allow a small buffer and avoid a stop-out on a minor pullback immediately after breakeven activates.
Interaction between trail and breakeven#
- If the trailing stop fires first, the breakeven monitor is removed immediately and the trailing stop continues managing the stop-loss going forward.
- If breakeven fires first, the trailing stop monitor is removed and any pending multi-SL targets for that position are also cleared. Breakeven then moves the stop once and its own monitor is removed.
- If both monitors would trigger at the same effective price (within one pip of each other), neither is registered. The signal acknowledgement includes a warning describing this.
Data Flow Summary#
You submit a signal with trailing and/or breakeven parameters to the webhook. The platform validates every parameter (types, value ranges, and mutual exclusivity within each parameter group) and, for the standalone trail command, confirms that at least one distance mode is present. A valid signal is queued and delivered to your connected EA. The EA receives the parameters, computes a single activation price from the specified trigger mode, and registers the monitor against the specific position ticket. The monitor then runs locally on your terminal, evaluating on each price tick. When the trigger fires, the EA submits a stop modification to the broker. Both successful modifications and failures are logged locally in the EA's trade log and forwarded to the platform as events tied to the license and position, where they are available in Signal Logs.
User-Facing States#
| State | What It Means | Impact |
|---|---|---|
| Trail registered | The EA accepted the monitor and is evaluating it each tick. | The stop-loss will begin moving once the trigger condition is met and price moves by at least the step size. |
| Trail active | The trigger threshold was crossed and the stop is now following price. | The stop advances each time price moves far enough beyond the step floor. |
| Trail deregistered | The monitor was removed: breakeven fired, a notrail signal was sent, or the position closed. | The stop-loss stays at the last level the trail set; no further automatic movement. |
| Breakeven registered | The EA accepted the monitor and is waiting for the trigger price. | The stop-loss will not move until price crosses the trigger threshold. |
| Breakeven triggered | Price crossed the trigger threshold and the stop was moved to the configured breakeven level. | The stop is now at entry plus any configured offset. The monitor is gone and will not fire again. |
| Breakeven deregistered | The monitor was removed: trail fired, a nobreakeven signal was sent, or the position closed before the trigger was reached. | The stop-loss remains at whatever level it was when the monitor was removed. |
Error Messages and Meanings#
Messages fall into two groups by where you encounter them.
Validation errors (group A) are returned by the platform before the signal reaches the EA. They appear as the HTTP response body to the webhook caller (so TradingView's alert execution status shows them) and are persisted as a row in your dashboard at Signal Logs → Rejected Signals tab. That row carries the timestamp, license, command, symbol, a pill identifying the offending parameter, and the verbatim reject reason. Two conditions must be met for the row to be created: the platform must be able to extract a valid license key from the payload, and the signal must have failed for a known validation reason. If the payload is malformed enough that no license can be parsed, you see the TradingView response but no Rejected Signals row is created. The reject reason is stored in full; only very long reasons are shortened, and none of the messages below are that long.
EA runtime warnings (group B) are emitted by the EA during tick processing. They appear in the MetaTrader Experts tab and in the EA's local support log file.
| Group | Message | Cause | What to do |
|---|---|---|---|
| A | "Conflicting trailing stop parameters" | The signal specified more than one distance mode: for example, both distance_pips and distance_pct. | Remove all but one distance mode. Use distance_pips, distance_pct, or distance_atr (not a combination). |
| A | "Conflicting step parameters" | Both trail_step and trail_pct_step were included in the same signal. | Remove one. trail_step pairs with pips-mode trails; trail_pct_step pairs with percentage-mode trails. |
| A | "Conflicting trail trigger parameters" | More than one trail trigger parameter was specified. | Keep only one: trail_trigger, trail_trigger_pct, or trail_trigger_price. |
| A | "Conflicting breakeven trigger parameters" | More than one breakeven trigger parameter was specified. | Keep only one: be_trigger_pips, be_trigger_pct, or be_trigger_price. |
| A | "Conflicting breakeven offset parameters" | More than one breakeven offset parameter was specified. | Keep only one: be_offset_pips, be_offset_pct, or be_offset_price. |
| A | "trail command requires a distance parameter" | A trail command was sent without any distance mode. | Add one distance mode to the signal: distance_pips, distance_pct, or distance_atr. |
| A | "trail_step=0 is invalid. Must be greater than 0 (minimum SL move in pips)." | trail_step was zero or negative. | Set trail_step to a positive pip value, or omit it to trail continuously without a step floor. |
| B | Trailing stop: SL update skipped because the proposed stop is within the broker's STOPS/FREEZE level; will retry when price moves further. | The proposed new stop is closer to market than the broker's minimum stop distance. The EA skipped this tick and will retry. | No action needed. The stop will move as soon as price creates enough separation from the broker's freeze zone. If the message persists for several minutes, the configured trail distance may be smaller than the broker's current minimum stop distance for that instrument. |
| B | Auto-breakeven: SL is within the broker's STOPS/FREEZE level, cannot move to breakeven yet; will retry when price moves further. | The calculated breakeven stop level is inside the broker's minimum stop distance. The EA will retry. | The broker's minimum stop distance is temporarily wider than the breakeven level, which happens during high-volatility windows. The move will execute once price clears the zone. If the position closes before it fires, no action is needed. |
| B | ATR trailing skipped while the ATR indicator warms up (no message is written). | The ATR indicator has not yet produced its first value. Expected on the first tick or two after position open. Because the EA writes no log line here, nothing appears in the Experts tab for this. | No action needed. The EA silently skips ATR trailing for that tick and resumes automatically once the indicator is ready. |
| B | Auto-breakeven: skipping ticket (position no longer exists). | After an EA restart, a saved monitor referenced a position that no longer exists at the broker. The monitor was discarded. This line is only written when the EA log level is set to Debug, so at the default log level it does not appear in the Experts tab. | If the position is still open at the broker but not recognized by the EA, reconnect. If the position is already closed, no action is needed. |
Out-of-range parameter rejections#
The following out-of-range values are rejected at signal validation. The webhook returns HTTP 400, the signal is not delivered to the EA, and the rejection is recorded in Signal Logs -> Rejected Signals tab with the verbatim reason (the offending value is inserted where the example below shows a sample):
distance_atroutside the range 0.1 to 20.0:Invalid value '25' for distance_atr - must be between 0.1 and 20.0 (ATR multiplier)trail_atr_periodoutside the range 2 to 500:Invalid value '600' for trail_atr_period - must be between 2 and 500distance_pctnot greater than 0 and at most 99:Invalid value '150' for distance_pct - must be greater than 0 and at most 99- an unrecognized
trail_atr_timeframe:Invalid value 'H2' for trail_atr_timeframe; must be one of: D1, H1, H4, M1, M15, M30, M5, MN1, W1
Where to look#
| If you see a message from... | Where to look |
|---|---|
| Group A (validation) | Signal Logs → Rejected Signals tab in the dashboard. The row shows the timestamp, command, symbol, the offending parameter as a pill, and the verbatim reject reason. The same record also appears in the merged Signal Logs timeline alongside successful signals. TradingView's alert execution status shows the same message as the HTTP response. |
| Group B (EA runtime) | The Experts tab in MetaTrader and the EA support log file in your MQL5 Files folder. |
Plan and Tier Differences#
Trailing stop and auto-breakeven are available on every active plan (including Trial) with no functional differences across tiers:
| Feature | Trial | Standard | Pro | Premium |
|---|---|---|---|---|
| Trailing stop (pips, percent, ATR modes) | Available | Available | Available | Available |
| Auto-breakeven | Available | Available | Available | Available |
| Trail trigger modes (pips, percent, price) | Available | Available | Available | Available |
| Breakeven offset modes (pips, percent, price) | Available | Available | Available | Available |
| ATR timeframe configuration | Available | Available | Available | Available |
The limits on concurrent trail and breakeven monitors per EA instance are platform constants tied to hardware and broker interface capacity, not plan tier limits. Under typical trading conditions, you will not reach them.
When a subscription lapses, the platform stops delivering new signals. Trail and breakeven monitors already registered on the EA continue running locally until each position closes, because they execute entirely on your terminal without server involvement. New trail or breakeven signals cannot be registered until the subscription is restored.
Known Edge Cases and Gotchas#
- Setting be_trigger_pips, be_trigger_pct, or be_trigger_price to 0 for auto-breakeven is treated as no trigger specified: no monitor is registered, the same as omitting the trigger. To move to breakeven immediately when the position opens, specify a small positive trigger value, or use the standalone breakeven command.
- A negative be_offset_pips value is valid and intentional. For example, be_offset_pips=-5 on a buy sets the stop-loss five pips below the entry price rather than at it, giving the position a small buffer before the stop fires after breakeven activates.
- ATR step size is not user-configurable. It is always 10% of the current trailing distance (i.e. 10% of ATR value x your distance_atr multiplier) and changes each tick as the indicator updates.
- In ATR mode, the trail distance itself changes on each tick as the ATR indicator updates. A widening ATR extends the follow distance; a narrowing ATR tightens it. The stop-loss does not move backward regardless of how ATR changes.
- Manually editing the stop-loss in MetaTrader after a breakeven monitor is registered does not disable the monitor. The EA overrides the manual edit when the trigger fires.
- The same applies to trailing stop monitors: a manual stop-loss edit in the broker platform does not deactivate the trail.
- If trail and breakeven would both activate at the same effective price (within one pip), neither is registered. A warning appears in the signal acknowledgement.
- Trail and breakeven monitors persist across EA restarts. On restart the EA reloads them from local files, verifies each referenced position is still open, and discards monitors for positions that no longer exist.
- trail_step must be a positive number. Zero and negative values are rejected at signal validation.
- An unrecognized trail_atr_timeframe value is rejected at signal validation (HTTP 400) and recorded in Rejected Signals; it is not silently ignored. When trail_atr_timeframe is omitted entirely, the EA uses the chart's current timeframe (the timeframe of the chart the EA is attached to).
Frequently Asked Questions#
Q: Can I use both trailing stop and auto-breakeven on the same position at the same time? A: Yes. Both monitors are active simultaneously and do not interfere with each other until one fires. At that point the other is removed automatically.
Q: What happens if my EA restarts while a trail or breakeven monitor is active? A: Both monitor types are saved to local files on the MT5 machine and reloaded on restart. If the position is still open at the broker, monitoring resumes from where it left off. If the position closed while the EA was offline, the monitor is discarded on reload.
Q: What is the difference between trail_trigger and the trail distance? A: The trail distance is how far behind price the stop follows once trailing is active. The trigger is the profit threshold at which trailing begins. For example, with a 30-pip trigger and a 20-pip trail distance, the stop does not move at all until price is 30 pips in profit, after which it begins following at a 20-pip distance.
Q: What does a negative be_offset_pips value do for auto-breakeven? A: It places the stop-loss slightly on the loss side of entry after the trigger fires. For example, be_offset_pips=-5 on a buy moves the stop to five pips below entry rather than to entry exactly. Some traders prefer this to avoid a stop-out on a minor pullback right after the breakeven trigger fires.
Q: My trailing stop isn't moving even though price is well into profit. What should I check? A: Check whether the trigger threshold has been crossed, whether the step size is larger than price has moved since the last update, and whether a STOPS_LEVEL violation message appears in the Experts tab.
Q: My breakeven didn't fire even though price reached my target. Why? A: The most common reasons are that the trigger price was not crossed on the bid or ask (as opposed to the mid or chart price), the position closed before the trigger fired, or a trailing stop fired first and removed the breakeven monitor.
Q: Can I change the trail distance after a position is open? A: Yes. Send a trail signal for the same symbol with the updated distance parameters. The EA replaces the existing monitor with the new configuration.
Q: What does ATR mode mean and which timeframe should I use? A: ATR (Average True Range) measures recent price volatility. In ATR mode, the trail distance is the current ATR value multiplied by the factor you specify, so the stop automatically adjusts to market conditions. The hourly timeframe (H1) is a common starting point for intraday positions; daily (D1) suits longer-term holds. If no timeframe is specified, the EA uses the chart's current timeframe (the timeframe of the chart the EA is attached to).
Q: What happens if the broker's minimum stop distance blocks a trail or breakeven update? A: The EA detects the constraint before submitting the modification, skips that tick, and retries on the next price update. No action is needed. If the message persists for an extended period, the configured distance may be smaller than the broker's current minimum stop distance for that instrument during the prevailing spread.
Q: How do I remove a trailing stop or breakeven monitor without closing the trade? A: Send a notrail or nobreakeven signal for the symbol. The EA removes the monitor immediately and the stop-loss stays at its current level.
Q: My signal was rejected with "trail command requires a distance parameter." What does that mean? A: The trail command must include at least one distance mode: distance_pips, distance_pct, or distance_atr. A trigger or step parameter alone is not sufficient; the distance tells the EA how far behind price to keep the stop.
Q: Is there a limit on how many trail or breakeven monitors can be active at once? A: The platform supports a large number of concurrent monitors per EA instance. These limits are set at the hardware and broker interface level, not by plan tier, and are high enough that normal trading activity will not approach them.