Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Equity Target Closer - close all trades at a profit or loss level - expert for MetaTrader 5

Augusto Martin D'anna
Augusto Martin D'anna
MQL5 & Pine Script developer | Trader since 2019 | Strategy validation
As a trader, I know a bot is only as good as the logic behind it. I bridge
trading concepts and clean code: I don't just follow instructions, I make
sure your EA behaves exactly the way your strategy intends.
Views:
69
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Equity Target Closer is a simple utility that closes all your trades when the account reaches a profit target or a loss limit. It does not open trades and does not analyse the market: you trade manually or with other EAs, and it takes care of the exit at the level you set. Attach it to one chart.

How it works

  • On every tick and once per second it measures the P/L of the positions it watches.
  • When the P/L reaches the profit target or the loss limit, it closes all those positions at market and (optionally) deletes the pending orders.
  • Optionally it pauses until the next day: any new trade opened after the close is closed again, so the day stays locked.

Inputs

  • What to measure - floating P/L of open positions only, or today's P/L (closed trades of the day + open positions). Deposits and withdrawals are never counted.
  • Units - money (account currency) or % of balance.
  • Close all at this profit - 0 disables it.
  • Close all at this loss - write it as a positive number; 0 disables it.
  • Only this symbol - empty = all symbols.
  • Only this magic number - -1 = all trades, 0 = manual trades only, or the magic of one EA.
  • Also delete pending orders.
  • Pause until tomorrow after closing.
  • Day reset hour - server hour when the trading day starts (used for today's P/L and the pause).

Notes

  • Works on any symbol and timeframe, on netting and hedging accounts.
  • Closing is at market: in fast markets or gaps the final result can be a bit past the level. Tested in the Strategy Tester with random trades: it closed every time at the target or the limit.
  • Typical uses: lock a daily profit, cap the daily loss of a manual session, or close a basket of one EA at a money target.
Simple License - lock your EA to accounts, expiry date, demo-only or server Simple License - lock your EA to accounts, expiry date, demo-only or server

Minimal include file to license your own EAs and indicators: allowed account numbers, expiry date, demo-only trial mode and broker server filter. Example EA included.

Prop Firm Guardian - daily loss, max loss and profit target lock Prop Firm Guardian - daily loss, max loss and profit target lock

Account guardian for prop firm rules: closes all trades and blocks trading before the daily loss or max loss limit is hit, with an optional profit target lock.

Execution Quality Logger - slippage, fill delay and spread of every deal Execution Quality Logger - slippage, fill delay and spread of every deal

Logs the slippage, fill delay and spread of every deal on the account (manual, EAs, SL/TP hits) to a CSV file and shows a live summary. It never trades.

Common Folder Copier - copy positions between MT5 terminals on the same PC Common Folder Copier - copy positions between MT5 terminals on the same PC

Local MT5-to-MT5 trade copier through the Common files folder. One EA in Master or Slave mode: lot multiplier or fixed lot, symbol prefix/suffix, reverse, SL/TP and partial close sync.