EquityTargetCloser MT4
- Utilities
-
Evgeniy Zhdan
➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖
Products: https://www.mql5.com/en/users/trendhunter/seller
➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖ - Version: 2.10
- Updated: 5 May 2026
- Activations: 5
Automatic profit locking when target profit is reached
EquityTargetCloser — is a utility expert advisor for MetaTrader 5 that automatically closes all market positions and deletes pending orders as soon as equity exceeds the current balance by a specified profit amount. After all positions are closed, the target automatically increases: the new threshold = new balance + specified profit. The EA does not open trades, it only manages existing positions, helping to reliably lock in profit and protect accumulated funds.
MT5-version: https://www.mql5.com/en/market/product/169839
How it works
The expert advisor continuously compares equity with a dynamic target:
-
Target = current balance + plusMoney (in US dollars).
-
When equity becomes greater than or equal to this amount, the protection is triggered:
-
All market positions (for any symbols) are closed.
-
If the parameter Delete pending orders = true , all pending orders are deleted.
-
After the positions are closed, the balance updates and the target is recalculated: new balance + plusMoney. Thus, the expert advisor successively raises the profit-taking level with each successful cycle.
Important: The trigger condition depends on accumulated floating profit, not on the absolute value of equity. If the balance increases (for example, due to closed positions), the target automatically rises.
Input parameters
| Parameter | Description |
|---|---|
| Profit in $ for closing market orders: | Desired profit in US dollars. Condition: Equity ≥ Balance + plusMoney. |
| Delete pending orders: | Whether to delete pending orders when triggered (true – delete, false – keep). |
Graphical interface
A button is displayed on the chart that shows:
-
the current target level (Balance + plusMoney);
-
button color: green — the EA is active (the button is pressed), red — inactive.
The button also serves for manual verification: if you click it at any time, the EA will immediately evaluate the condition and perform the closing if the target is reached.
Advantages
-
Dynamic balance-based target – after each profit capture, the threshold automatically increases, allowing capital scaling.
-
Focus on real profit – monitors equity exceeding balance, not an abstract level.
-
Full automation – requires no constant supervision; locks in profit the moment it is achieved.
-
Versatility – works with any instruments and number of positions.
-
Safety – does not open trades, does not modify stop-losses, does not conflict with other EAs.
-
Easy setup – only two parameters.
Who is it for
-
Manual traders – protect accumulated profit without being distracted from market monitoring.
-
Users of grid and martingale EAs – set a common profit threshold to exit in profit in time.
-
Account managers – automatically close all positions when the target return is reached (e.g., +5% to balance).
-
Developers – use as a ready-made risk management module.
Usage recommendations
-
Attach the expert advisor to any chart (e.g., EURUSD M1).
-
Set the desired profit in deposit currency (plusMoney).
-
Enable automated trading (AutoTrading button).
-
Click the button on the chart so that it turns green.
-
The EA will automatically close positions when Equity ≥ Balance + Profit in $ for closing market orders and raise the target after each closure.
