Kalifx Local trade copier
- Utilità
- Calvin Andile Mahlangu
- Versione: 1.0
Kalifx Local Trade Copier is built to replicate trades from one trading account (Master) to another (Slave) in real time.
Its main purpose is to copy trading activity—such as opening, modifying, and closing trades—so that multiple accounts can follow the same strategy without manual intervention. This is especially useful for managing multiple accounts, testing strategies across different brokers, or mirroring trades between accounts.
The EA operates in two modes:
MASTER: Monitors trading activity and records all open positions and pending orders.
SLAVE: Reads this information and automatically duplicates the trades on another MT5 terminal, keeping both accounts synchronized.
This EA is designed for local copying between MT5 terminals using the Common Files folder
(FILE_COMMON), so both terminals can access the same snapshot file name.
Key Features
------------
- Single EA utility for both MASTER and SLAVE modes.
- Copies positions and pending orders.
- Pending handling modes:
- Copy as pending orders.
- Wait for master pending trigger and copy only as market position (via POS record).
- Trade inversion option (BUY<->SELL).
- Symbol mapping and excluded symbols list.
- Fixed lot, lot multiplier, risk-% sizing, max lot.
- Daily risk controls for slave:
- Max trades per day.
- Max daily drawdown (% or money).
- Trade-copy count multiplier (duplicate each master trade into multiple slave trades).
- Spread filter.
Important Notes
---------------
- Designed for MT5 terminals on the same machine/VPS (or environments sharing Common Files).
- Broker symbol specifications (contract size, step, min lot, digits, stops level) can differ.
Always test on demo first.
- Copy speed depends on ticks + timer and terminal responsiveness.
Quick Start (Master/Slave Setup)
--------------------------------
1) Install EA
- Put Local Trade Copier.mq5 in MQL5/Experts.
- Compile in MetaEditor.
2) MASTER terminal setup
- Attach EA to any chart.
- Set Mode = MODE_MASTER.
- Set CopierFileName (default: TradeCopy.txt).
- Set TimerSeconds (e.g. 1).
3) SLAVE terminal setup
- Attach EA to any chart.
- Set Mode = MODE_SLAVE.
- Use the same CopierFileName as master.
- Configure inputs (symbol mapping, lot/risk, pending mode, filters, daily limits).
4) Verify operation
- MASTER should keep updating the snapshot.
- SLAVE should open/modify/close according to MASTER snapshot.
Input Settings Reference
------------------------
[Core]
- Mode
Select MODE_MASTER or MODE_SLAVE.
- SkipExistingTradesOnStart
When set to true, the EA in Slave mode will ignore any trades that were already open on the Master account at the time the EA starts.
It will only begin copying new trades opened after initialization.
[Lot Control]
- UseFixedLot
If true, use FixedLot for copied trades.
- FixedLot
Fixed lot size.
- LotMultiplier
If not fixed lot, slave lots = master lots * LotMultiplier.
- MaxLot
Absolute lot cap.
- UseRiskPercent
If true, lot is calculated from account risk.
- RiskPercent
Percent of account balance risked per trade.
- RiskSL_Pips
Fallback SL distance used for risk lot sizing when SL distance is unavailable.
[Trade Behavior]
- InvertTrades
Reverse direction (BUY->SELL, SELL->BUY).
- CopyStopLoss
Copy SL from master when fixed SL is not used.
- CopyTakeProfit
Copy TP from master when fixed TP is not used.
- UseFixedSL / FixedSL_Pips
Override SL using fixed pip distance.
- UseFixedTP / FixedTP_Pips
Override TP using fixed pip distance.
[Pending Handling]
- PendingMode
PENDING_COPY_AS_PENDING:
Slave places/modifies pending orders.
PENDING_EXECUTE_MARKET:
Slave does NOT open from pending records; it waits until master pending triggers
and appears as an open position in snapshot.
[Daily Limits] (SLAVE)
- EnableMaxTradesPerDay / MaxTradesPerDay
Block new entries after daily trade count limit is reached.
- MultiplyCopiedTrades
Enable trade count replication multiplier.
- CopiedTradesMultiplier
Number of slave copies per one master trade (e.g. 2 = open 2 slave trades).
- EnableMaxDrawdownPerDay
Enable daily drawdown guard.
- MaxDrawdownPercent
Block new entries when daily equity drawdown reaches this percent.
- MaxDrawdownMoney
Block new entries when daily equity drawdown reaches this money value.
[Spread Filter]
- EnableSpreadFilter
Enable spread check before new entries.
- MaxSpread
Maximum allowed spread (points).
[Symbol Mapping]
- SymbolMap
Map master symbol to slave symbol.
Format:
EURUSDm=EURUSD;XAUUSDm=XAUUSD
Separator between pairs:
;
- ExcludedSymbols
Symbols to skip copying.
Supports ';' or ',' separators.
[Execution]
- SlaveMagic
Magic number used by slave trades/orders.
- Slippage
Deviation/slippage in points for trade execution.
[Misc]
- CopierFileName
Snapshot file name in Common Files.
Recommended Safe Configuration
------------------------------
- Start on DEMO accounts first.
- Keep UseRiskPercent = true with small RiskPercent (e.g. 0.5% to 1%).
- Use EnableMaxTradesPerDay and EnableMaxDrawdownPerDay.
- EnableSpreadFilter in volatile markets.
- Confirm SymbolMap and ExcludedSymbols before going live.
Troubleshooting
---------------
1) No trades copied
- Check Mode (master/slave).
- Check same CopierFileName on both terminals.
- Check symbol mapping and excluded symbols.
- Check daily limits and drawdown guard are not blocking entries.
2) Wrong symbols copied
- Fix SymbolMap pairs.
- Confirm slave symbol exists and is enabled in Market Watch.
3) Lots not as expected
- Review UseFixedLot, LotMultiplier, UseRiskPercent, MaxLot.
- If MultiplyCopiedTrades=true, count of trades increases per master trade.
4) Pending behavior confusion
- In PENDING_EXECUTE_MARKET, pending records are not copied as pending.
Slave waits for master pending trigger (position appears in snapshot).
Disclaimer
----------
Trading involves significant risk. This software does not guarantee profits and may produce losses.
Use at your own risk. Always test thoroughly on demo before live deployment.
