Breakeven Manager
Moving a stop to breakeven after a trade has proven itself is one of the most common pieces of trade management, and one of the easiest to forget to do by hand in a fast market. This EA does exactly that one job: once a position has moved InpTriggerPips in profit, its stop loss is moved to the entry price, adjusted by InpBufferPips. The buffer input does double duty by its sign. A positive buffer moves the stop past entry in the profitable direction, locking in enough to cover the spread and commission so "breakeven" is a genuine breakeven rather than a guaranteed small loss once costs are counted. A negative buffer sets the stop short of entry, useful when the trigger distance is generous and a small give- back is preferable to breakeven arriving too early. The rule this EA is strict about is that a stop only ever tightens. Once breakeven has been applied, running the check again - which happens every tick by default - recomputes the same candidate and finds it no better than the stop already in place, so nothing is sent. That also means it is safe to run alongside a separate trailing stop tool: whichever one has moved the stop further in the trader's favour, the other's candidate loses the comparison and is skipped rather than overwriting the better stop. Notes and limitations - This EA never opens, closes or resizes a position, and it never moves a stop away from the position's favour. - A position with no stop loss at all is moved to breakeven as soon as it qualifies; there is no existing stop to compare against. - Applies once per position by design - after breakeven is set, the never-move-backward rule makes every subsequent pass a no-op unless a candidate is genuinely better (which cannot happen from this EA's own logic alone, only from a separate trailing tool improving the stop further). - Uses live Bid/Ask to judge profit, so the trigger is read against real-time price, never a value computed ahead of the tick that produced it. - A stop candidate that lands inside the broker's stop or freeze level is skipped and logged by ticket rather than sent and rejected. - On an MQL5 netting account, InpMagicFilter selects or excludes an entire symbol's net position, not individual trades within it - see MQL4 VERSUS MQL5 DIFFERENCES above.
Expert advisor · MT4 · v1.0 · Free
About Breakeven Manager
Breakeven Manager is a script for MetaTrader 4. It has 7 settings, such as Trigger pips, Buffer pips and Magic filter. MQL source code included.
Files in the download: BreakevenManager.ex4, BreakevenManager.mq4, BreakevenManager.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Trigger pips | 20 | Profit distance, in pips, that arms breakeven |
| Buffer pips | 0 | Buffer past entry, in pips (negative locks a small profit, positive covers costs) |
| Magic filter | -1 | Magic number filter (-1 = every magic) |
| Current symbol only | true | Restrict to this chart's symbol |
| Once per bar | false | Re-evaluate only on a new bar, not every tick |
| Max retries | 5 | Attempts per modify before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trailing Stop & Break-even · MT4 Expert Advisor · MQL4 Source Code