There is no MetaTrader 4 API. Not an official one, not a Python package, not a REST endpoint. People searching "MT4 API" are looking for a thing MetaQuotes never shipped, and every result that claims otherwise is either a broker's Manager API (not for you), a paid DLL bridge, or an EA someone wrote in 2014.
That's the short answer. The longer one matters because the MT4 vs MT5 API question is really a migration question, and the migration has a trap in it that has nothing to do with HTTP.
What MT4 actually gives you
MT4 exposes exactly one way to run code: MQL4, executing inside the terminal. Expert Advisors, indicators, scripts. That's it. Everything else people call an "MT4 API" is built on top of that:
- DLL imports. An MQL4 EA can call functions from a Windows DLL you wrote. This is how the commercial bridges work: the EA loads a DLL that opens a socket or a named pipe, and your external program talks to the DLL. It requires "Allow DLL imports" ticked in the terminal, a Windows box, and trust in whoever compiled the DLL.
- File bridges. The EA writes CSV or JSON to
MQL4/Files/on a timer; your program polls the directory. Latency is the timer interval. It breaks the moment two processes write the same file. - Socket bridges. Since build 600-ish, MQL4 got
WebRequestfor HTTP out, and with a DLL you can do raw sockets. Same shape as the MT5 EA bridges, with older tooling. - Broker Manager API. MetaQuotes licenses a server-side Manager API to brokers. If you are not a broker, this does not exist for you.
All four need a running MT4 terminal on Windows, logged in, per account, with your bridge code alive inside it. There is no way to read an MT4 account from outside a terminal without something you wrote or bought sitting in that terminal.
What MT5 adds
MT5 keeps MQL5 (a bigger, C++-flavoured successor to MQL4 with classes, a standard library, and a real strategy tester) and adds two things MT4 never had.
An official Python package. pip install MetaTrader5 gives you account
info, positions, orders, deal history, ticks, candles, and order_send() from
Python. It's an IPC bridge to a local terminal, so it's still Windows-only and
still one terminal per account, but it's MetaQuotes' own code with
documentation, not a forum DLL. The
package vs REST comparison
goes deep on its limits.
A richer data model, and the ecosystem that grew on it. Because MT5 is where MetaQuotes puts its effort, it's also where the third-party infrastructure went: hosted terminals, REST layers, copiers with APIs. MetaKit is one of those, and it is MT5 only. There is no MT4 mode, and there won't be, because the underlying terminal automation we rely on doesn't exist for MT4.
The MT5 API guide lists all five categories of MT5 access with their tradeoffs.
The data model change is the real migration work
Here's the trap. Developers coming from MT4 assume the migration is "same thing, new endpoints". It isn't. The objects are different.
In MT4, an order is a position. You OrderSend(), you get a ticket, that
ticket is your open trade, and OrderClose() on the same ticket ends it.
Pending orders and open trades live in the same list (OrdersTotal()), told
apart by OrderType(). History is a list of closed orders. One object, one
id, cradle to grave.
In MT5, there are three objects:
- An order is intent: a market or pending instruction. Once filled, it's gone from the live list and appears in order history.
- A deal is a fill. A round-trip trade produces at least two deals, an
inand anout, sharing aposition_id. Profit is booked on theoutdeal. - A position is the current net exposure, created and modified by deals.
Every MT4 assumption that "ticket equals trade" breaks. Counting deals double-counts trades. Reading profit off the entry gives you zero. Partial closes, which were separate tickets in MT4, are one position with three or four deals in MT5. We wrote the orders, deals, positions explainer because this one bug shows up in nearly every port.
Then there's netting vs hedging. MT4 accounts are always hedging: buy 1 lot twice and you hold two independent trades. MT5 accounts run in one of two modes chosen by the broker. Hedging behaves like MT4. Netting collapses every fill on a symbol into one position, so buy 1, buy 1, sell 1 leaves a single 1-lot position and a deal trail that doesn't map to MT4 tickets at all. Code that assumes hedging produces nonsense on a netting account; the netting vs hedging post covers how to detect and handle both.
Smaller things bite too. MT5 pending order types include stop-limits. Volumes
and fill policies (ORDER_FILLING_FOK, IOC, RETURN) are explicit and
broker-dependent. Symbol names come with suffixes more often (EURUSD.pro,
XAUUSD.r). None of this is hard. All of it is work the MT4 version of your
code never had to do.
Where MetaQuotes is pointing
MT4 is legacy. MetaQuotes stopped selling new MT4 server licences to brokers years ago, and the terminal receives compatibility patches, not features. Every meaningful release is MT5: the recent build 6060 alone added Trader and Money Manager access levels, passkey login, and a native MCP interface in the terminal (for the trader's own AI assistant, not an application API; we covered what it does and doesn't do). None of that is coming to MT4.
Brokers follow the money. Most now open MT5 accounts by default, several have stopped onboarding new MT4 clients, and a few have set dates for switching MT4 off entirely. Whether a given broker has done so depends on the broker; ask them, and ask what the timeline is, because "we support MT4" and "we plan to support MT4 in two years" are different sentences.
What migrating means for a trader
Two facts that surprise people.
It's a new account. An MT4 login is not an MT5 login. The broker opens a fresh MT5 account, with a new number and new server, and you transfer funds between the two. Open positions don't move; you close on MT4 and reopen on MT5, or wait to be flat.
History doesn't transfer. Your MT4 trade history stays on the MT4 account. The MT5 account's history starts on day one. If you show a track record to investors or a prop firm, export the MT4 statement before the account is closed, because once the broker retires the MT4 server it may be gone. Any analytics you build on the MT5 side (win rate, drawdown, Sharpe) begin from the first MT5 deal.
Otherwise, for a discretionary trader, the day-to-day differences are manageable: the terminal looks familiar, the order window has more fields, and a hedging MT5 account feels like MT4 did.
What migrating means for a developer
Rank the work honestly:
- Data model (most of the effort). Rewrite anything that iterated
orders as trades. Group deals by
position_id. Handle both accounting modes. Test on one netting and one hedging account before believing a number. - MQL4 to MQL5, if you have EAs. Different function names
(
OrderSendbecomesOrderSendwith anMqlTradeRequeststruct, which is more work than the name suggests), event handlers (OnTickstays,start()goes), strict typing, and a standard library worth learning. Budget days per EA, not hours. - Bridge replacement (least effort, if you go external). If your MT4 integration was a DLL or file bridge, you get to delete it. On MT5 the Python package covers local Windows automation, and a hosted REST API covers everything else.
That third point is the actual payoff. An MT4 shop that hand-built a socket bridge and a watchdog can, on MT5, connect the account to a hosted terminal and read it over HTTP:
curl https://api.metakit.cloud/v1/accounts/2/deals?from=2026-07-01&limit=100 \
-H "Authorization: Bearer $METAKIT_KEY"Each deal in data carries its position_id, so the grouping from the
explainer is a one-liner, or you call /v1/accounts/2/performance and let it
be done for you. The Python walkthrough
covers connecting; llms.txt is the full
reference.
The realistic path for an MT4 user who wants an API
Say it plainly, since the search brought you here: there is no API to find for MT4. Your choices are a bridge you maintain inside an MT4 terminal on a Windows box, or a move to MT5 where the package, the ecosystem, and hosted options all exist.
If you're staying on MT4 for a specific EA that only exists in MQL4, fine; run the bridge and accept the maintenance. If you're on MT4 out of habit, the account you'd open on MT5 is the one your broker wants to give you anyway. Open it, keep the MT4 one until you're flat, and do the data model work once.