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 eventTarget action
Position opened (DEAL_ENTRY_IN)Market order on the target, same magic number
Partial closePro rata partial close of the target position
Full close (OUT, OUT_BY)Full close of the target position
Stop loss or take profit changedmodify_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

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.