MT5 API

MetaTrader 5 API on a real, hosted MT5 terminal

Tickwire is a hosted MetaTrader 4 and 5 API with REST, WebSocket and an MCP server, from $12 per account a month. It 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 is Tickwire?

Tickwire is a hosted API for MetaTrader 4 and MetaTrader 5. It runs a real MT4 or MT5 terminal in the cloud for each trading account and works with any broker that offers MT4 or MT5. Your code, trading tools and AI agents use it over REST, WebSocket or a hosted MCP server that works with AI apps such as Claude and ChatGPT. Plans start at $12 per account a month, with a 7-day free trial and a free sandbox. All the facts.

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

Health is healthy, degraded, stale, disconnected or down. An account is healthy only when the broker link is up, the account was read and prices are moving. A closed market shows degraded with prices_stale, and market orders get 409 quote_stale. Signed webhooks tell you when health 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.

First call

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. marginMode in the account information says which an account uses. On hedging accounts, a close names its positionId.
  • 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.

API reference
Coming from another MetaTrader API
MT5 from Python on Mac and Linux
MT5 return codes and errors explained

AI agents

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

Tickwire for AI trading agents
The MetaTrader MCP server

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.

The MT4 API
MetaTrader web API

Try the MT5 API

7-day free trial. Then from $12 per account a month. See pricing.