An MT5 copy trading API between accounts, MT4 too
Tickwire lets you copy trades from one MT5 or MT4 account to many with your own code: stream the source account, open each copy on up to 20 followers in one call, and use keys that make a retry safe. Tickwire doesn't run a copy service for you. It gives you the API to build one.
How a copier works
A copier fails in two ways: it copies a trade twice, or it silently misses one. Each step below guards against one of those.
- Listen to the source. Open the source account's stream and act on new and closed positions.
- Map symbols and size. Brokers name symbols differently, such as
EURUSDm, and have different lot steps. Build a map per follower fromGET …/symbolsand…/specification. - Fan out with fixed keys. One key per source position and follower, so a retry can't copy twice.
- Handle unknown. When a copy can't be confirmed, read the follower before doing anything else.
- Check health first. Skip followers that are disconnected, and decide on purpose when they come back.
1. Listen to the source
The account stream sends a full sync, then a frame for each change. A new position is your signal to copy, and a removed one is your signal to close the copies.
websocat -H "auth-token: $TW_KEY" "wss://api.tickwire.io/users/current/accounts/$SOURCE/ws"
{"type":"subscribe"}
# act on "positionUpdated" (a new position) and "positionRemoved" (closed) Keep the session id and the last sequence number, so a reconnect picks up what you missed. See Streaming.
2. Copy to one follower
For a few followers, send one trade each. The key comes from the source position and the follower, so a restarted worker sends the same key.
import requests
def copy_open(follower, src):
return requests.post(
f"{TW}/users/current/accounts/{follower}/trade",
headers={
"auth-token": KEY,
"Idempotency-Key": f"open-{src['id']}-{follower}",
"X-Actor": "copier",
"X-Reason": f"copy of {src['id']}",
},
json={
"actionType": "ORDER_TYPE_BUY" if src["type"] == "POSITION_TYPE_BUY" else "ORDER_TYPE_SELL",
"symbol": map_symbol(follower, src["symbol"]),
"volume": size_for(follower, src),
"clientId": f"cp_{src['id']}",
},
timeout=30,
).json() 3. Or copy to many in one call
POST /v1/orders sends one order to up to 20 accounts. Each leg takes the defaults and can change
any field, such as the symbol name or the volume. Fields are snake_case.
curl -s -X POST "https://api.tickwire.io/v1/orders" \
-H "X-API-Key: $TW_KEY" \
-H "Idempotency-Key: open-46870472" \
-H "X-Actor: copier" -H "X-Reason: copy of 46870472" \
-H "content-type: application/json" \
-d '{
"defaults": {"symbol": "EURUSD", "operation": "buy", "volume": 0.10,
"stop_loss": 1.0800, "comment": "cp_46870472"},
"orders": [
{"account_id": "acc_A1"},
{"account_id": "acc_B2", "symbol": "EURUSDm", "volume": 0.05},
{"account_id": "acc_C3", "volume": 1.00}
]
}'
The answer lists one result per leg, in the same order. Repeat the call with the same
Idempotency-Key within 15 minutes and you get the stored answer back with
idempotent_replay: true. Each leg also carries its own key to its terminal, so a retry after a
crash never fills a leg twice.
| Leg status | Meaning | What your copier does |
|---|---|---|
filled | The broker accepted the leg | Record it |
rejected | The broker refused; retcode says why | Log it, don't loop |
invalid | The terminal refused the request | Fix the leg, for example the volume step |
unavailable | The terminal is up but not trading | Record a missed copy |
unreachable | No terminal for that account | Record a missed copy |
timeout | Unknown: it may have executed | Read the follower's positions first |
4. Close the copies
POST /v1/orders/close closes by selector on up to 20 accounts: a symbol, or * for
all, with symbol_match: "base" to accept broker suffixes. You can also filter by side, kind or
magic number, list tickets, or close part of the volume.
curl -s -X POST "https://api.tickwire.io/v1/orders/close" \
-H "X-API-Key: $TW_KEY" \
-H "Idempotency-Key: close-46870472" \
-H "X-Actor: copier" -H "X-Reason: source 46870472 closed" \
-H "content-type: application/json" \
-d '{"accounts": [
{"account_id": "acc_A1", "symbol": "EURUSD", "symbol_match": "base"},
{"account_id": "acc_B2", "symbol": "EURUSD", "symbol_match": "base"}
]}' Rules to keep
- Authorised accounts only. Copy only into accounts whose owners agreed. See our acceptable use policy.
- Never retry with a new key. After
timeoutorunknown, read first. - Size per follower. Cent accounts and small balances need very different volumes.
- Mind the limits. 60 batches a minute per tenant. See Rate limits.
- Test on a demo account first.
How trade copiers work
Symbol names and specs
Retries that never trade twice
Questions
Is there a copy trading API for MT5?
Tickwire gives you the parts to build one: a stream of the source account's positions, a batch order call that opens a trade on up to 20 follower accounts at once, and idempotency keys so a retry never copies twice. Tickwire does not run a copy-trading service itself.
Can I copy trades between MT4 and MT5 accounts?
Yes. MT4 and MT5 accounts share the same API, so a source on one platform can feed followers on the other. Map symbol names per broker, and check volume limits on each follower.
How do I stop a copier from copying a trade twice?
Derive the Idempotency-Key from the source position and the follower, for example open-{source id}-{follower}. A crashed and restarted worker then sends the same key, and Tickwire returns the first answer instead of opening a second position.
What if a copy comes back unknown or timeout?
Don't send a new order. Read the follower's positions and orders, look for your clientId or comment, then decide. A retry with the same key never places a second order, but it won't tell you the outcome.
Can I copy trades into other people's accounts?
Only into accounts whose owners have authorised it. Copying into someone else's account without permission is banned by our acceptable use policy and by most prop firms.
What does it cost?
Each source and follower account is billed as one account: from $12 a month each, after a 7-day free trial. Batch orders are included.
Build your copier
7-day free trial. Then from $12 per account a month. See pricing.