An MT5 API on a real, hosted MetaTrader 5 terminal
Tickwire runs a MetaTrader 5 terminal for each of your accounts and puts a REST and WebSocket API in front of it. Read the account, trade, stream prices and check health from any language. There's no terminal for you to keep running.
What the MT5 API covers
Everything below works on MT5 accounts today, with any MT5 broker.
Account data
Balance, equity, margin, free margin and leverage. Open positions, pending orders, deals and history orders. Symbols and their specifications.
Trading
Market, limit, stop and stop-limit orders. Modify stop loss and take profit, close in full or in part, and close-by on hedging accounts.
Market data
Quotes, candles on all 21 MT5 timeframes, historical ticks and market depth.
Streaming
One WebSocket per account with a full sync, then updates. Every frame has a sequence number, so you can resume after a disconnect.
Health you can trust
An account is healthy only when the broker link is up, the account was read and ticks are
moving. Signed webhooks tell you when that changes.
Safe retries
Send an Idempotency-Key with each order. A retry gets the first result back. If a result
can't be confirmed, the answer is unknown, not a guess.
From sandbox to first MT5 order
Start in the free sandbox, which needs no broker account. When your code works, connect your MT5 account and change only the key and the account id.
# A free sandbox key and MT5 account: no card, no broker login
curl -s -X POST "https://api.tickwire.io/v1/sandbox/signup" \
-H "content-type: application/json" -d '{"platform": "mt5"}'
# Read the account
curl -s "https://api.tickwire.io/users/current/accounts/acc_7Qx/account-information" \
-H "auth-token: $TW_KEY"
# Buy 0.01 EURUSD. The same Idempotency-Key again returns the first result.
curl -s -X POST "https://api.tickwire.io/users/current/accounts/acc_7Qx/trade" \
-H "auth-token: $TW_KEY" \
-H "Idempotency-Key: first-order-1" \
-H "X-Actor: my-app" -H "X-Reason: first MT5 order" \
-H "content-type: application/json" \
-d '{"actionType": "ORDER_TYPE_BUY", "symbol": "EURUSD", "volume": 0.01}' The answer
{
"numericCode": 10009,
"stringCode": "TRADE_RETCODE_DONE",
"orderId": "46870472",
"positionId": "46870472",
"outcome": "applied"
}
You get MT5's own return code and a plain outcome: applied, rejected or
unknown. See idempotency and outcomes.
MT5 details we handle for you
- Hedging and netting.
marginModein the account information says which an account uses. On hedging accounts, a close names itspositionId. - Broker time. MT5 servers keep their own time, which isn't UTC. UTC fields are real UTC, and broker-local times are in separate, labelled fields. See time zones.
- Symbol names. Some brokers add suffixes (
EURUSDm). The symbols endpoint lists the exact names. - Any broker. Give the server name from the terminal's login dialog. There's no per-broker setup.
Two API styles, one account
Call /users/current/accounts/{id}/… with the auth-token header, or the
terminal routes /mt5/{id}/… (AccountSummary, OrderSend, …)
with X-API-Key. Both keep the request and response shapes existing clients already call.
An MCP server for MT5
Claude, ChatGPT and other apps that support remote MCP servers can use your MT5 accounts as tools: read accounts and prices, place and close orders, and read their own audit log. You pick the accounts and whether the app may only look or also trade.
https://api.tickwire.io/mcp Also on MT4
The same API serves MT4 accounts, with the same fields. A few MT5 features don't exist on MT4, and those calls say so.
Try the MT5 API
7-day free trial. Then from $12 per account a month. See pricing.