MT4 API

MetaTrader 4 API on a real, hosted MT4 terminal

Tickwire is a hosted MetaTrader 4 and 5 API with REST, WebSocket and an MCP server, from $12 per account a month. MetaTrader 4 has no official API of its own. Tickwire runs an MT4 terminal for each of your accounts and gives it the same REST and WebSocket API as MT5, with the same fields. Where MT4 can't do something, the call says so instead of returning made-up data.

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 works on MT4

Most of the API is the same on both platforms. MT4 is older and lacks a few features. Calls for them return the error not_supported_on_mt4.

MT4 and MT5 capabilities
CapabilityMT5MT4
Account information, positions, pending orders Yes Yes
Market, limit and stop orders; modify; full and partial close Yes Yes
Quotes and candles Yes, 21 timeframes Yes: 1m 5m 15m 30m 1h 4h 1d 1w 1mn
History Deals, orders and positions Closed orders, exposed as deals and history orders
Streaming, health, webhooks, audit log, idempotency keys Yes Yes
Close-by Yes, on hedging accounts Depends on the broker
Market depth Yes not_supported_on_mt4
Historical ticks Yes not_supported_on_mt4
Stop-limit orders Yes not_supported_on_mt4
DAY and SPECIFIED_DAY expiry on pending orders Yes not_supported_on_mt4
Netting accounts Yes No, MT4 accounts are hedging only
Terminal order check on trade/check Yes No, the request is still checked

Live MT4 ticks are captured from the time you subscribe, so there's no tick history to read back.

No surprises

Check before you call

Ask an account what it supports instead of catching errors. Code written for both platforms can branch on the answer.

# Ask the account what it supports
curl -s "https://api.tickwire.io/users/current/accounts/acc_7Qx/capabilities" -H "auth-token: $TW_KEY"
{
  "platform": "mt4",
  "features": {
    "marketDepth": false,
    "historicalTicks": false,
    "stopLimitOrders": false,
    "closeBy": "broker_dependent",
    "nettingAccounts": false,
    "orderCheck": false
  },
  "timeframes": ["1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w", "1mn"]
}

An unsupported call

{
  "error": "not_supported_on_mt4",
  "message": "market depth is not available on MT4",
  "tickwireError": "not_supported_on_mt4",
  "feature": "market depth"
}

Nothing is faked. You get a clear error and can fall back, for example to candles instead of ticks.

MT4 details we handle for you

  • Partial closes. MT4 reopens the rest of a position under a new ticket. Tickwire finds it and returns it, so you keep track.
  • History as deals. MT4 only keeps closed orders. Tickwire turns them into deals and history orders with the same fields as MT5.
  • 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.
  • Broker time. Broker-local times are labelled as such. UTC fields are real UTC.
  • Any broker. Give the server name and the broker's public server address (host:port) from the login dialog or the broker's site, or upload the broker's .srv file. No per-broker integration. See broker onboarding.

One API for MT4 and MT5

Pick the platform when you create an account ("platform": "mt4"). After that, every endpoint, field and stream frame is the same as on MT5. The terminal routes live at /mt4/{id}/…, next to /mt5/{id}/….

The MT5 API
Quickstart
MetaTrader web API
MT4 and MT5 error codes explained

AI agents

MT4 accounts for AI agents

The Tickwire MCP server works with MT4 accounts too. Connect Claude, ChatGPT or another MCP app, sign in, and pick the accounts it may use. See AI trading agents.

https://api.tickwire.io/mcp

Try the MT4 API

7-day free trial. Then from $12 per account a month, the same price as MT5. See pricing.