Advertisement IC Markets

Automating Trade Management: Break-Even and Trailing EAs

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS Prop Desk
Posts: 415
Joined: Wed Oct 07, 2026 9:52 am

Automating Trade Management: Break-Even and Trailing EAs

Post by FXS Prop Desk »

Trade management EAs handle exits after a manual entry. They remove hesitation and enforce rules.

A common problem is conflicting rules: a break-even rule and a trailing stop that both try to move the same stop. Defining a clear priority order in the EA settings avoids unexpected behaviour.

Another practical point: a management EA should ignore positions it did not open unless told otherwise, or it may start modifying trades from another strategy on the same account.

Common functions:
  • Move stop to break-even after X pips or R.
  • Trailing stop by pips, ATR or swing points.
  • Partial close at first target.
  • Time-based exit.
Considerations:
  • Test management rules on historical trades before using them.
  • Make sure the EA works with your broker's stop level.
  • Check behaviour after disconnections.
Do you use trade management EAs, and which rules do you automate?
FXS Official Team | The Idea Lab & Strategy
Recommended broker for automated trading & scalping IC Markets
Shadow Trader
Posts: 959
Joined: Wed Sep 09, 2026 5:19 pm

Re: Automating Trade Management: Break-Even and Trailing EAs

Post by Shadow Trader »

The conflicting rules point is the one that bit me. My break even rule moved the stop at 6 pips, then the trailing rule moved it back to 8 pips behind price because it calculated from the entry and didn't check whether the stop was already better.

The fix was a rule that a stop can only ever move in the trade's favour. Any change that would widen it gets ignored. Simple, but it wasn't the default in the EA I was using.

On break even, I'd add the spread and commission. A stop at the exact entry price closes at a small loss after costs. I set mine at entry plus 0.7 pips on EURUSD, which covers my round trip.

The disconnection point deserves more attention. If the EA moves stops locally and the VPS drops, the last stop sent to the server is what protects you. I make sure every change is sent to the server immediately rather than held in the EA.

Do you trigger break even by pips or by R? I've found R behaves better across pairs.
Shadow Trader
Posts: 959
Joined: Wed Sep 09, 2026 5:19 pm

Re: Automating Trade Management: Break-Even and Trailing EAs

Post by Shadow Trader »

Testing management rules on historical trades is harder than it sounds, because data resolution changes the answer. A trailing stop tested on M1 bars can't see the tick that went against you inside the bar, so it shows fewer stop outs than reality.

When I retested my trailing rules on tick data, the average winner came out roughly 15% smaller than the M1 test suggested. Same trades and same rules, just a more honest replay.

Partial closes have their own trap at small size. A 0.02 lot position can't be split into thirds when the minimum is 0.01, so the EA either skips the partial or closes everything, depending on how it was coded.

On ignoring other positions, I'd filter by magic number rather than the comment field. On MT4 a partial close replaces the comment on the remaining position with a reference to the original ticket, so a comment filter can lose its own trade halfway through.

Mine moves the stop to break even only after the server confirms the partial. Does yours run the partial and the break even in a fixed order, or whichever triggers first?
Post Reply