High-performance, low-latency multi-terminal trade copier and synchronization utility for MetaTrader 5 featuring automated risk controls, drawdown protection, and real-time execution alerts.
- MQL5 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| Images | ||
| README.md | ||
| UniversalMasterSlaveCopier.mq5 | ||
MQL5
MQL5 Algo Forge / murari576
UniversalTradeCopier is a local multi-terminal copier designed for MetaTrader 5 that synchronizes trades across accounts on the same machine/VPS using the shared filesystem (FILE_COMMON). It eliminates the need for DLLs, local web servers, or external network bridges.
Built specifically with prop firm rules in mind (such as FTMO and The5ers), this utility features persistent daily drawdown capping, daily profit targets, margin utilization checks, and instant trade alerts via desktop audio, popups, and Telegram.
Key Features
- Zero-DLL Architecture: Operates strictly within native MQL5 sandbox permissions using FILE_COMMON for sub-millisecond execution.
- Persistent Daily Risk Engine: Computes real-time PnL from broker history deals starting at 00:00:00 server time. Daily drawdown (-1.8%) and daily profit target (+1.2%) lockout states persist across chart reloads, VPS reboots, and terminal restarts.
- Prop-Firm Volume Guard:
- Enforces a minimum 5-pip Stop Loss floor to prevent oversized lots on tight stops.
- Limits lot size to a safe ratio per $10,000 balance (default 1.0 lot / $10k).
- Caps margin consumption to a maximum of 50% free margin per position.
- Adds spread padding directly to the cumulative running-risk budget.
- Master Automation: Auto-triggers 25-pip Breakeven with a 50% partial close, trailing stop routines, and emergency CLOSE_ALL broadcast upon hitting target equity.
- Multi-Slave Support: Supports multiple independent slave terminals reading from a single master queue concurrently without file-locking bottlenecks.
- Instant Notifications: Integrated audio alerts, modal popups, and Telegram alerts for executions and single-instance daily lock events.
Setup Instructions
-
Master Terminal Setup:
- Attach UniversalTradeCopier.mq5 to any chart (e.g., EURUSD or GBPUSD M15).
- Set InpCopierRole = ROLE_MASTER.
- Enable Algo Trading on the main MT5 toolbar.
-
Slave Terminal Setup:
- Attach UniversalTradeCopier.mq5 to any chart on the slave terminal.
- Set InpCopierRole = ROLE_SLAVE.
- Assign a unique magic number (e.g., 200201 for Slave 1, 200202 for Slave 2).
- Configure prefix/suffix if broker symbol names differ (e.g., EURUSD.pro vs EURUSD).
- Enable Algo Trading on the slave terminal.
-
Telegram Setup (Optional):
- Add https://api.telegram.org in Tools -> Options -> Expert Advisors -> Allow WebRequest for listed URL.
- Set InpEnableTelegram = true and paste your Bot Token and Chat ID.
Key Inputs Summary
- InpCopierRole: Set to ROLE_MASTER or ROLE_SLAVE.
- InpBridgeFileName: Shared queue filename (default: MasterMultiSlaveQueue.txt).
- InpSlaveMagic: Unique magic number assigned per slave.
- InpRiskPerTradePct: Sizing risk percentage per trade (default: 0.7%).
- InpMaxDailyLossPct: Daily drawdown limit cap (default: 1.8%).
- InpMaxDailyProfitPct: Daily profit target lockout (default: 1.2%).
- InpMaxLotsPer10k: Max permitted lot volume per $10k balance (default: 1.0).
- InpMinSLPips: Minimum SL floor in pips for sizing calculations (default: 5.0).