GRInvest Breakeven Manager mt5
- Yardımcı programlar
- Sürüm: 2.58
- Güncellendi: 20 Ağustos 2026
GRInvest Breakeven Manager is an MT5 trade-management Expert Advisor designed to manage existing open positions after entry. Its purpose is to automate breakeven protection, staged partial closes, trailing stops and position management while still giving the trader full manual control over individual trades.
The EA does not need to open trades itself. It can manage manual trades and trades opened by other Expert Advisors according to the selected symbol, direction and magic-number filters.
The design focuses heavily on one-shot execution, persistent state protection and avoiding duplicate partial closes.
1. Breakeven Management
The EA can automatically move the Stop Loss to breakeven once a position reaches a configurable amount of profit.
Main breakeven settings include:
-
Enable/disable automatic breakeven.
-
Profit points required before BE is triggered.
-
Configurable positive offset beyond the entry price.
-
Separate handling for BUY and SELL positions.
For example:
-
BUY opened at 4000.00
-
BE trigger = +500 points
-
BE offset = +50 points
Once the required profit is reached, the EA can move the SL above the original entry rather than exactly onto it.
For SELL positions the logic is reversed.
The EA will not deliberately move an existing stop backwards to a worse level.
2. Partial Close 1 — PC1PC1 is the first automated partial-close stage.
It is normally triggered at the same profit threshold used for automatic breakeven.
The trader can configure:
-
Enable/disable PC1.
-
Percentage of the current position to close.
-
PC1 automatic trigger through the breakeven threshold.
Example:
-
Position = 0.10 lots
-
PC1 = 50%
-
EA closes approximately 0.05 lots when PC1 is triggered.
The exact volume is adjusted according to the broker's:
-
minimum lot size;
-
lot step;
-
permitted remaining volume.
The EA attempts to leave a valid tradable remainder rather than accidentally closing the full position.
3. Breakeven and PC1 Are IndependentA critical feature of the current version is that Breakeven and PC1 have separate completion states.
Using the manual SET ALL BE button:
-
moves the selected positions to breakeven;
-
marks BE as applied;
-
does not mark PC1 as completed;
-
does not prevent PC1 from executing later.
If PC1 is still waiting, it remains:
PC1: WAIT
PC1 becomes completed only when:
-
PC1 is actually executed;
-
PC1 reaches a condition where it cannot legitimately partial-close and its one-shot handling is completed;
-
or the trader manually selects SKIP.
Simply moving an SL to breakeven does not imply that PC1 has been taken.
This distinction is maintained across EA reloads and MT5 restarts.
4. Partial Close 2 — PC2PC2 is a completely separate second partial-close stage.
It has its own:
-
enable/disable option;
-
profit trigger;
-
partial-close percentage;
-
persistent completion state.
Example:
-
PC1 = 50% at +1,000 points
-
PC2 = 50% of the remaining volume at +3,000 points
PC2 can therefore manage the remaining position independently of PC1.
5. Persistent Partial-Close ProtectionOne of the main safety systems in the EA is persistent one-shot protection.
The EA remembers whether PC1 or PC2 has already been completed for an individual position.
This protects against duplicate partial closes caused by events such as:
-
EA input changes;
-
EA reinitialisation;
-
recompilation;
-
timeframe changes;
-
chart reloads;
-
MT5 terminal restarts;
-
rebuilding the EA's internal position array.
Completion information is stored outside the temporary in-memory position array so the EA does not simply forget that a partial close has already occurred.
The position's persistent identity is used wherever possible rather than relying exclusively on a temporary in-memory state.
The objective is simple:
PC1 should execute once.
PC2 should execute once.
Reloading the EA must not make either stage available for execution again.
6. PC Status — WAIT / DONE / SKIPEvery managed position has an independent status for PC1 and PC2.
Possible states are:
WAIT
The partial has not been taken and remains available.
DONE
The partial has already been completed.
SKIP
The trader manually instructed the EA never to perform that partial close for this position.
Example display:
#26020120 BUY 0.10L +2450 pts PC1: DONE PC2: WAIT
Or:
#26020120 BUY 0.05L +2450 pts PC1: SKIP PC2: WAIT
These states are position-specific.
7. Manual PC1 / PC2 ControlsEach managed position can display its own manual controls.
Example:
#26020120 BUY 0.10L +2450 pts PC1: WAIT [CLOSE] [SKIP] PC2: WAIT [CLOSE] [SKIP]
CLOSE
Pressing CLOSE manually executes the relevant partial close immediately.
It uses the same configured PC percentage and broker-aware volume calculation as the automatic system.
For example:
-
PC1 percentage = 50%
-
Press PC1 CLOSE
-
EA immediately attempts to close 50% according to the current valid lot size.
Once successful, PC1 becomes:
DONE
SKIP
Pressing SKIP does not close any volume.
Instead, it permanently tells the EA that this PC stage should not be used for that specific position.
Example:
PC1: SKIP
The automatic PC1 trigger will then ignore that position permanently.
PC1 and PC2 have independent CLOSE and SKIP controls.
8. Manual/Automatic Duplicate ProtectionThe EA protects against the manual and automatic systems attempting to execute the same partial simultaneously.
For example, if the trader presses:
PC2 CLOSE
at almost exactly the same moment price reaches the automatic PC2 trigger, the EA uses an execution lock and persistent state checks to prevent two PC2 closes being deliberately initiated from the two management paths.
9. Trailing StopThe EA includes an independent automatic trailing-stop system.
Configurable settings include:
-
enable/disable trailing stop;
-
profit required before trailing begins;
-
trailing distance;
-
trailing step;
-
minimum update interval.
The trailing stop is designed to move only in the profitable direction.
For a BUY:
-
SL can move upward as price rises;
-
it is not deliberately trailed back downward.
For a SELL:
-
SL can move downward as price falls;
-
it is not deliberately trailed back upward.
A configurable update interval also prevents unnecessary SL modification requests on every individual tick.
10. BUY and SELL FiltersThe trader can independently control which direction the EA manages.
Settings include:
-
Manage BUY positions: ON/OFF
-
Manage SELL positions: ON/OFF
Examples:
BUY only
ManageBuys = true ManageSells = false
SELL only
ManageBuys = false ManageSells = true
Both
ManageBuys = true ManageSells = true11. Manual Trades
Manual trades normally have:
Magic Number = 0
The EA can be configured specifically to manage these positions.
This allows the Breakeven Manager to act as a standalone trade manager for manually entered MT5 positions.
12. Single Magic Number ManagementThe EA can manage positions belonging to one specific Expert Advisor using its magic number.
Example:
MagicNumberToManage = 12345
Only positions matching that magic number are managed when the corresponding filtering mode is being used.
13. Multiple Magic NumbersThe EA also supports a comma-separated list of magic numbers.
Example:
MagicNumbersToManage = 0,2,5
or:
MagicNumbersToManage = 0, 2, 5, 10001, 20002
This allows one instance of the Breakeven Manager to manage positions created by several different EAs as well as manual positions.
14. Manage All Magic NumbersA dedicated option allows the EA to ignore magic-number restrictions entirely:
ManageAllMagicNumbers = true
When enabled, the EA can manage every magic number on the current chart symbol, including:
-
magic 0 manual trades;
-
fixed-magic EAs;
-
EAs using different magic numbers;
-
EAs dynamically generating magic numbers.
Magic filtering priority is:
Priority 1
ManageAllMagicNumbers = true
Manage every magic number.
Priority 2
If Manage All is disabled and a list is entered:
MagicNumbersToManage = 0,2,5
Manage those numbers.
Priority 3
If no list is entered, use the original:
-
ManualTradesOnly
-
MagicNumberToManage
settings.
15. Symbol ProtectionThe EA manages positions belonging to the symbol of the chart it is attached to.
For example:
An instance on:
XAUUSD
manages applicable XAUUSD positions.
An instance on:
BTCUSD
manages applicable BTCUSD positions.
Using Manage All Magic Numbers therefore does not mean blindly managing unrelated symbols across the entire terminal.
16. SET ALL BE ButtonThe chart interface contains a:
SET ALL BE
button.
This immediately attempts to move all qualifying managed positions on the current symbol to the configured breakeven level.
Importantly:
SET ALL BE ONLY SETS BREAKEVEN.
It does not:
-
close PC1;
-
mark PC1 DONE;
-
mark PC1 SKIP;
-
mark PC2 DONE;
-
perform a partial close.
Example:
Before:
PC1: WAIT PC2: WAIT
After pressing SET ALL BE:
PC1: WAIT PC2: WAIT
The SL has been moved to BE, but the partial-close states remain independent.
17. CLOSE ALL ButtonThe EA includes a manual:
CLOSE ALL
button.
It applies to positions that match the EA's current symbol and management filters.
A confirmation stage is used to reduce the chance of an accidental single-click close.
18. EA ON/OFF ControlThe chart interface includes an EA management toggle:
EA: ON
or:
EA: OFF
This allows automated management to be paused from the chart interface without removing the EA.
19. Information PanelThe EA provides a configurable information panel showing important management settings and position information.
Depending on the selected panel mode, information can include:
-
EA status;
-
BUY/SELL management state;
-
BE trigger;
-
BE offset;
-
PC1 settings;
-
PC2 settings;
-
trailing-stop settings;
-
magic-number filter;
-
News Protection state;
-
managed position tickets;
-
BUY/SELL direction;
-
current lot size;
-
current profit in points;
-
PC1 status;
-
PC2 status;
-
CLOSE/SKIP buttons.
Several panel display modes are available so the trader can choose between a full information display and more compact layouts.
20. Automatic Removal of Closed-Position ControlsWhen a managed position closes, the EA removes its associated position information and manual partial controls from the chart.
Unused panel labels are hard deleted, rather than simply having their text hidden.
This prevents old:
-
ticket information;
-
PC1/PC2 rows;
-
CLOSE buttons;
-
SKIP buttons;
-
panel labels
from remaining as chart remnants after a position has disappeared.
The EA also performs cleanup during initialisation to remove panel objects left behind by an abnormal reload or previous EA version.
21. News Protection EA IntegrationThe Breakeven Manager can optionally communicate with the GRInvest Universal News Protection Manager.
The two EAs remain separate programs.
They communicate using shared MT5 Terminal Global Variables.
Default communication prefix:
GRINVEST_NEWS_BLOCK
The News Protection EA acts as the master authority for whether a protected news window is currently active.
22. Behaviour During News ProtectionWhen the linked News Protection EA reports that protection or post-news recovery is active, the Breakeven Manager temporarily stops actions that could interfere with protected positions.
During the protection state, it blocks:
-
automatic PC1;
-
automatic PC2;
-
automatic breakeven SL movement;
-
automatic trailing-stop movement;
-
manual PC1 CLOSE;
-
manual PC2 CLOSE;
-
manual SET ALL BE.
This is particularly important when the News Protection EA temporarily removes SL/TP levels around high-impact news.
Without the handshake, the Breakeven Manager could potentially see the removed SL and attempt to add a new BE or trailing SL while the News EA is intentionally protecting the position.
23. Controls Still Available During NewsThe trader retains certain manual controls during news protection.
The EA can continue to allow:
-
PC1 SKIP;
-
PC2 SKIP;
-
CLOSE ALL;
-
chart panel/status updates.
SKIP remains available because it does not place a partial-close trade or modify SL/TP.
24. Partial Close Is Not Lost During NewsIf price reaches a PC trigger while News Protection is active, the partial is not automatically marked as completed.
Example:
PC2 trigger = +3000 points
Price reaches:
+3300 points
during the news protection window.
The EA blocks PC2.
PC2 remains:
PC2: WAIT
When protection finishes, if the position still satisfies the PC2 trigger, the EA can execute PC2 normally.
This prevents News Protection from silently consuming or cancelling a legitimate partial-close stage.
25. News Protection Recovery HandshakeThe News Protection EA can maintain the protection signal not only during the scheduled news period but also while post-news restoration is unresolved.
This means the Breakeven Manager does not immediately start changing stops or taking partials while the News EA is still:
-
restoring the original SL;
-
restoring the original TP;
-
processing saved recovery state;
-
resolving a protected position.
A short renewable expiry/heartbeat mechanism is used rather than a permanent boolean lock.
If the News Protection EA stops unexpectedly, the protection signal can eventually expire instead of leaving the Breakeven Manager permanently disabled.
26. Broker-Aware Partial Lot CalculationPartial-close volume calculations consider the symbol's:
-
SYMBOL_VOLUME_MIN
-
SYMBOL_VOLUME_STEP
-
current position volume
The EA normalises the amount to a broker-valid volume.
It also attempts to ensure a valid remainder is left open after the partial close.
This avoids sending obviously invalid lot sizes such as a volume below the broker's minimum or one that does not respect the lot step.
27. Trade Execution ValidationPartial closes use explicit MT5 trade requests and verify the returned trade result.
The EA can attempt compatible order filling modes where necessary and checks the broker result before considering the close successful.
This helps make the trade-management process more robust across brokers with different execution configurations.
28. Failed Partial HandlingAutomatic partials use one-shot protection.
If an automatic PC action reaches a state where repeatedly attempting the same close every tick would be unsafe or undesirable, the EA prevents uncontrolled repeated requests.
Manual CLOSE behaviour is handled separately so the trader can deliberately retry an unsuccessful manual action where appropriate.
29. Persistent State Across ReloadsThe EA is designed so important one-shot management information is not dependent only on local variables that disappear when the EA reloads.
Persistent information includes PC completion and skip state.
This is intended to protect against scenarios such as:
PC2 executes ↓ EA inputs changed ↓ EA reloads ↓ Price is still above PC2 trigger
The expected behaviour is:
PC2: DONE
and not another PC2 close.
30. Historical RecoveryThe persistent-state system also includes support for recognising certain previous partial-close activity from trade history.
This was introduced to provide safer migration from older versions of the EA that did not originally store persistent PC1/PC2 state.
The priority remains preventing an existing position from receiving an unintended duplicate partial close.
31. Overall Management SequenceA typical position can therefore be managed like this:
POSITION OPENS │ ▼ PC1 / BE threshold reached │ ├── PC1 closes configured % │ └── SL moves to BE + offset │ ▼ PC2 threshold reached │ └── PC2 closes configured % of remaining volume │ ▼ Trailing trigger reached │ └── SL trails price according to distance/step │ ▼ Remaining position continues toward TP / SL / manual close
Any individual PC stage can instead be manually:
[CLOSE]
or:
[SKIP]
32. Example Position Display-- BREAKEVEN MANAGER 2.58 -- STATUS: RUNNING NEWS PROTECTION: CLEAR BUYS: ON SELLS: ON BE After: 75000 pts BE Offset: 1000 pts PC1 at BE: 33% of lot PC2 at 150000 pts: 50% of lot Trail Trigger: 300000 pts Trail Dist: 200000 pts Trail Step: 50000 pts Magic: ALL #244076844 BUY 0.01L +42300 pts PC1: WAIT [CLOSE] [SKIP] PC2: WAIT [CLOSE] [SKIP]33. Main Design Goals
The GRInvest Breakeven Manager is designed around five principles:
Automated protection
Move positions to breakeven and progressively protect profitable trades.
Flexible position reduction
Use two independent partial-close stages.
Manual control
Allow the trader to manually CLOSE or SKIP each PC stage per position.
Persistent safety
Do not repeat partial closes simply because MT5, the chart or the EA was reloaded.
EA compatibility
Manage manual trades or positions created by other Expert Advisors using single, multiple or unrestricted magic-number filtering.
Core Feature SummaryBreakeven
-
Automatic BE trigger
-
Adjustable BE offset
-
Manual SET ALL BE
-
BE independent from PC1
Partial Close
-
PC1 at BE threshold
-
Independent PC2 threshold
-
Individual percentages
-
Persistent one-shot protection
-
Broker-aware volume calculation
-
Manual CLOSE per PC
-
Manual SKIP per PC
-
WAIT / DONE / SKIP status
-
Manual/automatic duplicate protection
Trailing Stop
-
Adjustable trigger
-
Distance
-
Step
-
Update interval
Position Selection
-
BUY only
-
SELL only
-
BUY + SELL
-
Manual trades
-
Single magic number
-
Multiple comma-separated magic numbers
-
Manage all magic numbers
Chart Controls
-
EA ON/OFF
-
SET ALL BE
-
CLOSE ALL with confirmation
-
Per-position PC1 CLOSE/SKIP
-
Per-position PC2 CLOSE/SKIP
-
Multiple panel modes
Reliability
-
Persistent PC state
-
Historical recovery support
-
Hard removal of stale chart labels/buttons
-
Position-specific state
-
Trade-result validation
-
Protection against repeated partial execution
News Protection Integration
-
Shared MT5 handshake
-
Pauses BE/PC/trailing during protection
-
Pauses manual PC CLOSE and SET ALL BE
-
Leaves SKIP and CLOSE ALL available
-
Does not consume PC triggers during news
-
Resumes automatically after recovery
The EA is intended to act as a dedicated MT5 position-management layer: entries can come from the trader or another EA, while the Breakeven Manager handles protection, partial exits and ongoing position management according to a consistent set of rules.

é excelente, se tivesse um mini painel para colocar os parametros sem necessitar entrar nas propriedades seria melhor ainda, o trailling stop eu não entendi e deveria ter opção de desligar... eu uso outro expert a unica parte ruim é que os 2 não funcionam juntos um exclui o outro (o outro é um painel de trade)