Broker API HubMenu

Platform API

MetaTrader 5 Python API

MetaQuotes' multi-asset trading terminal. MQL5 programs run inside it, and the MetaTrader5 Python package talks to it locally.

Independent and unofficialNewest reading Official documentation

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Quickstart: key to first call

Access, authentication and streaming

API types listed in the record: Python package (MetaTrader5), MQL5, WebRequest and sockets from MQL5.

How you get access

Install the MT5 terminal from your broker, then pip install MetaTrader5 on Windows x86-64 or write MQL5 in MetaEditor. The terminal must be at build 4755 or later.

order_sendchecked

Who can use it

Real accounts come from brokers offering MT5; the API runs through your own local terminal.

Opening an account (MT5 help)checked

Demo

Yes: demo accounts can be opened from within the terminal.

Opening an account (MT5 help)checked

Authentication

No API keys: initialize() connects to the local terminal, optionally with account login, password and server.

initializechecked

Streaming

No push API in Python: poll ticks and bars; market_book_add subscribes the terminal to depth events. MQL5 EAs get tick events.

MetaTrader for Pythonchecked

History depth

Bars limited to the terminal's Max bars in chart setting. Deal history by date range with no stated limit.

MQL5 docs: copy_rates_fromchecked

Rate limits, as worded

Not published. The Python page states none, carries no version and no date, and gives no consolidated error list beyond last_error() (read 22 Sep 2026).

MetaTrader for Pythonchecked

MetaTrader 5 API SDKs and wrappers

LibraryLanguageOfficialNoteSource
MetaTrader5PythonOfficialOfficial MetaQuotes package, version 5.0.6231 of 27 Sep 2026, MIT licence, CPython 3.6 to 3.14, classified Production/Stable. Wheels are published for Windows x86-64 only, so the Python route is Windows only.pypi.orgchecked
Community Python MCP server (MQL5 article 21905)PythonCommunityA community route documented in MQL5's own article library on 30 Apr 2026, separate from the native MCP in build 6060. It exposes 14 tools including place, modify and cancel orders, is Windows only because of the MT5 Python API, is single-threaded, and executes on whatever account MT5 is logged into. It has no approval step. The author advises demo testing first.mql5.comchecked

MetaTrader 5 functions

78 documented functions. They are functions of a programming language, not HTTP endpoints: none has a method or a path, and the code runs against the terminal on your own computer. Grouped by what they do, each with its summary

MetaTrader5 Python package

MQL5

MetaTrader 5 API error codes

311 decoded error codes. All MetaTrader 5 (Python package and MQL5) errors

MetaTrader 5 API: questions and answers

Each answer is read from the record on this page, not written separately. Where the record is unverified, the answer says so.

How do I get access to the MetaTrader 5 API?

Install the MT5 terminal from your broker, then pip install MetaTrader5 on Windows x86-64 or write MQL5 in MetaEditor. The terminal must be at build 4755 or later.

order_sendchecked

Who can use the MetaTrader 5 API?

Real accounts come from brokers offering MT5; the API runs through your own local terminal.

Opening an account (MT5 help)checked

MetaTrader 5 API demo: is there a demo or sandbox?

Yes: demo accounts can be opened from within the terminal.

Opening an account (MT5 help)checked

What are the MetaTrader 5 API rate limits?

Not published. The Python page states none, carries no version and no date, and gives no consolidated error list beyond last_error() (read 22 Sep 2026).

MetaTrader for Pythonchecked

How does MetaTrader 5 API authentication work?

No API keys: initialize() connects to the local terminal, optionally with account login, password and server.

initializechecked

Does the MetaTrader 5 API support streaming?

No push API in Python: poll ticks and bars; market_book_add subscribes the terminal to depth events. MQL5 EAs get tick events.

MetaTrader for Pythonchecked

How much history does the MetaTrader 5 API return?

Bars limited to the terminal's Max bars in chart setting. Deal history by date range with no stated limit.

MQL5 docs: copy_rates_fromchecked

Is there a Python library for the MetaTrader 5 API?

This register lists these Python libraries for the MetaTrader 5 API. MetaTrader5 (official, Python): Official MetaQuotes package, version 5.0.6231 of 27 Sep 2026, MIT licence, CPython 3.6 to 3.14, classified Production/Stable. Wheels are published for Windows x86-64 only, so the Python route is Windows only. Community Python MCP server (MQL5 article 21905) (community, Python): A community route documented in MQL5's own article library on 30 Apr 2026, separate from the native MCP in build 6060. It exposes 14 tools including place, modify and cancel orders, is Windows only because of the MT5 Python API, is single-threaded, and executes on whatever account MT5 is logged into. It has no approval step. The author advises demo testing first.

MetaTrader5checked Community Python MCP server (MQL5 article 21905)checked

Which brokers offer MetaTrader 5?

Brokers on this register recorded as offering MetaTrader 5, with a source: Axi, IG, OANDA, Pepperstone, Swissquote, ThinkMarkets and Tickmill. Recorded as offering it but unverified: FxPro.

Axi UKchecked IG UK MetaTrader 5checked OANDA UK MetaTrader 5checked Pepperstone UK trading platformschecked Swissquote UK, forex and CFD platformschecked ThinkMarkets support: Spread betting accountchecked Tickmill UKchecked

MetaTrader 5 API questions, each answered in a sentence or two.

Everything this site records for MetaTrader 5 (Python package and MQL5), as one JSON file. Each section of the file states its own licence. About the files. This page as Markdown.

MetaTrader 5 API guides and reference

MetaTrader 5 API compared

The same fields from two records, side by side. No winner is picked.

What changed recently for the MetaTrader 5 API

The newest entries are shown. Every dated change, all brokers and platforms. Follow MetaTrader 5 changes by RSS

Sample apps that use the MetaTrader 5 API

Every app and sample

Open source repositories for MetaTrader 5

Read from GitHub's own records and ordered by stars as read. A listing is not a recommendation. The first of the list is shown here.

The full repository list

Partner programme

Not verified. No programme page was opened, which is not evidence that no programme exists. The MetaQuotes partner programme record. The programme register holds every record. This site carries no affiliate links.

Brokers that offer MetaTrader 5 (Python package and MQL5)

BrokerEntityNoteSource
AxiAxi Financial Services (UK) LimitedListed on Axi's UK site, which says MT5 lets you develop algorithmic strategies with Expert Advisors.Axi UKchecked
FxProFxPro group (UK entity not confirmed on page)Listed on platform comparison; entity not stated.UnverifiedFxPro platform comparisonchecked
IGIG UK (IG Markets Ltd / IG Index Ltd)MT5 offered to UK clients; page mentions running Expert Advisors, MQL5 and free VPS for qualifying accounts. Account type split (CFD vs spread bet) not stated on page.IG UK MetaTrader 5checked
OANDAOANDA Europe LimitedMT5 on web, desktop and mobile, live and demo. Expert Advisors allowed: 'Create expert advisors in MQL5 to automate your trading strategies'.OANDA UK MetaTrader 5checked
PepperstonePepperstone LimitedMetaTrader 5 is listed on the broker's UK platforms page for UK clients.Pepperstone UK trading platformschecked
SwissquoteSwissquote Ltd (UK)Listed on the UK private client forex and CFD platforms page, with Expert Advisors ticked in the comparison table.Swissquote UK, forex and CFD platformschecked
ThinkMarketsTF Global Markets (UK) LimitedSupport article: spread betting is available on ThinkTrader, MT4 and MT5 for UK residents, so MT5 is offered to UK clients.ThinkMarkets support: Spread betting accountchecked
TickmillTickmill UK LtdMT5 on Windows, macOS, mobile and WebTrader.Tickmill UKchecked

How to cite this

MetaTrader 5 Python API. Broker API Hub, https://openbrokerapi.com/platforms/metatrader-5, newest check .

Where you rely on a single figure, cite the source and the checked date printed beside it as well.

Sections