Copy trading
A copy rule watches one MT5 terminal (the source) and replays its trades onto another (the target) as they happen. Rules are managed from the portal at Copy trading; there is no public API for them yet. Only MT5 terminals can be a source or a target.
What is copied
| Source event | Target action |
|---|---|
Position opened (DEAL_ENTRY_IN) | Market order on the target, same magic number |
| Partial close | Pro rata partial close of the target position |
Full close (OUT, OUT_BY) | Full close of the target position |
| Stop loss or take profit changed | modify_position on the target with the new levels |
Netting flip (INOUT) | Close the copied position, then open the leftover as a new one (partial support) |
Only live deals are copied: a terminal that reconnects and replays history is never re-copied, and a deal older than 60 seconds is ignored even when it arrives live. Each rule runs its work in order, so an open can never overtake its own close.
While the account is suspended, inactive or out of credits, new opens are skipped and say why. Closes and SL/TP changes on copies already open still go out, so no position is left without an exit. A skipped open is not placed later when the account is back in good standing.
Rule settings
- Mirror mode takes the opposite side: a buy on the source becomes a sell on the target, and stop loss and take profit swap places.
- Magic filter is a list of magic numbers to copy. Empty means every trade on the source, including manual ones (magic 0 is not copyable by filter; leave the list empty to include it).
- Sizing is either a multiplier on the source volume (rounded to 0.01 lots; a result under 0.01 is skipped with a warning) or a fixed volume used for every copied open.
- Symbol map renames symbols between brokers (
EURUSDon the source becomesEURUSD.mon the target). Unmapped symbols are sent as they are. - Copy SL/TP can be switched off to size and close positions but leave the target's levels alone.
Loop guard and events
Every order the engine places carries the comment copy:<source position id>, and a deal whose
comment starts with copy: is never copied again. Two rules pointing at each other therefore
cannot ping-pong. Successful copies appear in the event feed as ordinary order.place,
order.close and order.modify events with actor system and label copy:<rule name>.
A copy that fails (target not running, order rejected, close rejected) records an alert.copy
event on the target terminal, so it reaches the same notification channels as any other
alert.
The pairing between a source position and its target ticket is kept as a CopyLink; the
portal shows the count of open links per rule. Deleting a rule leaves positions already open on
the target as they are.