A native library that connects your program directly to your broker's MetaTrader 4 or MetaTrader 5 server. No terminal, several accounts at once, on Windows and Linux.
Free with demo accounts, no license key needed.
The SDK works with the MetaTrader 5 brokers that offer the MetaTrader 5 web terminal, and with the MetaTrader 4 servers available in the MetaTrader 4 web terminal of MetaQuotes: not with all brokers. Before you buy, download the SDK and run the example with a demo account of your broker: demo accounts work without a license.
MetaTrader 5: you will need the address of your broker's web terminal (it starts with wss://). This video shows how to find it.
MetaTrader 4: you will need the name of your broker's server, as shown in MetaTrader 4 (for example MetaQuotes-Demo). You can check that it is available in the MetaTrader 4 web terminal.
Is your broker not available? The MTsocketAPI EA works with any MT4/MT5 broker, and it is included in the same subscription.
Your program connects straight to your broker's MetaTrader 4 or 5 server. Nothing to install, update or keep open.
Open as many connections as you need in the same process: copy trading, hedging, monitoring, account managers.
C#, Python, Java, C++ and Rust, with typed models and auto-completion in your IDE. No JSON to parse.
The same code runs on your PC, on a Linux VPS or inside a Docker container.
Ticks (and market depth in MT5) pushed to your code as events, with very low latency and low CPU usage.
Market, limit and stop orders, modify SL/TP, partial and full close, with the broker's result code.
Deals, orders and positions history, and OHLC candles in any timeframe from M1 to MN1.
The MQL5 economic calendar with actual, forecast and previous values, in UTC.
With the EA, your code talks to a MetaTrader terminal. With the SDK, your program logs in to the MT4 or MT5 server itself, using the same secure WebSocket connection as the MetaTrader web terminal.
Connect, read the balance, stream EURUSD and send an order. The download includes a complete example for MetaTrader 5 and for MetaTrader 4 in each language.
MetaTrader 4: create an MT4WebClient with the name of the server, for example new MT4WebClient("MetaQuotes-Demo"), instead of an MT5WebClient with the address of the web terminal. The rest of the code is the same.
Different accounts, different brokers, all in the same process.
Several live accounts at once need the Unlimited plan.
The compiled library for Windows and Linux, the bindings for each language and ready-to-run MT5 and MT4 examples for each one.
mtsocketapi-sdk.zip ├── README.md setup guide for each language ├── native/ │ ├── win-x64/ mtsocketapi_native.dll │ └── linux-x64/ libmtsocketapi_native.so ├── bindings/ │ ├── csharp/ Visual Studio solution + ExampleMT5, ExampleMT4 │ ├── python/ package + example_mt5.py, example_mt4.py │ ├── java/ classes + ExampleMT5.java, ExampleMT4.java │ ├── cpp/ header-only C++17 + CMake examples (mt5, mt4) │ └── rust/ crate + example_mt5, example_mt4 ├── include/ mtsocketapi.h (C API) └── selectors.default.json web terminal selectors (Browser mode)
| Operating system | Windows 10/11 or Linux, 64-bit |
|---|---|
| C# | .NET 8 (Visual Studio 2022) |
| Python | 3.8 or later, no extra packages |
| Java | 8 or later + JNA |
| C++ | C++17 compiler + CMake |
| Rust | stable toolchain |
| Broker | MT5: brokers that offer the MetaTrader 5 web terminal. MT4: servers available in the MetaTrader 4 web terminal |
| Browser and Hybrid modes | MT5 only: Microsoft Edge, Google Chrome or Chromium (optional: the default Direct mode needs nothing) |
| License | Demo accounts work without a key. Live accounts need a Retail, Professional or Unlimited plan. |
Your subscription includes both. Use the one that fits each project.
| MTsocketAPI EA | MTsocketAPI SDK NEW | |
|---|---|---|
| MetaTrader platform | MT4 and MT5 | MT4 and MT5 |
| Brokers | Any MT4/MT5 broker | MT5 brokers that offer the MetaTrader 5 web terminal, and MT4 servers available in the MetaTrader 4 web terminal |
| MetaTrader terminal needed | Yes, the EA runs inside it (Windows, or Wine) | No |
| How your code talks to it | REST API and WebSockets (TCP port 81) | Native library called from your code |
| Languages | Any language that speaks HTTP | C#, Python, Java, C++ and Rust (typed) |
| Where your program runs | Any system: on the same computer as the terminal, or from Linux, macOS, Android... through the EA's IP (remote connections: Professional plan) | Windows and Linux (64-bit): PC, VPS, Docker |
| Several accounts | One terminal per account. Need many accounts? Contact us | Many accounts in one program (Unlimited plan) |
| Remote access | Yes (Professional and Unlimited) | Not needed: your program connects from anywhere |
| Indicators (SMA, ATR, custom...) | Yes, from the terminal | No: compute them from the candles |
| Economic calendar | Yes | Yes |
| Best for | Existing terminals, any language, indicators | Servers, VPS, Docker, multi-account, low resources |
Yes. Every plan includes the EA and the SDK. They are two products with their own license: every payment email includes your EA license file, and the first one also includes your SDK license key, which then renews automatically with your subscription. With the Free plan, the SDK works with demo accounts without a license key.
Yes. The SDK works with MetaTrader 4 and MetaTrader 5, with the same license and the same plans: create an MT4WebClient for MT4 and an MT5WebClient for MT5, with the same methods. For MT4 you need the name of your broker's server, as shown in MetaTrader 4, your account number and your password. MetaTrader 4 has no market depth and no stop-limit orders, and it connects in Direct mode.
Not all of them. With MetaTrader 5, the brokers that offer the MetaTrader 5 web terminal: you need the address of your broker's web terminal (this video shows how to find it). With MetaTrader 4, the servers available in the MetaTrader 4 web terminal of MetaQuotes (metatraderweb.app): you need the name of your broker's server. In both cases you also need your account number and your password. Before you buy, try the SDK with a demo account of your broker: demo accounts work without a license. If your broker is not available, use the EA.
Yes. The Unlimited plan is designed for that: one program with as many live accounts as you need, connected at the same time. Retail and Professional include one live account. If you need many accounts with the EA, or a custom setup, contact us and we will find the right option for you.
That is up to you. The default is Direct, the fastest: the SDK speaks the protocol of the web terminal itself, with every feature and nothing else to install. The SDK also has two modes that run the official web terminal in a hidden browser (Microsoft Edge, Google Chrome or Chromium), so they can keep working if MetaQuotes changes the protocol of the web terminal: Hybrid, which takes longer to start, and Browser, which is also slower in every operation. You choose the mode with one option when you create the client. Browser and Hybrid are for MetaTrader 5; MetaTrader 4 uses the Direct mode. See Connection modes.
Pass it when you create the client: LicenseKey in C#, license_key in Python, C++ and Rust, licenseKey(...) in Java. The first run needs an internet connection to activate it.
Each version of the SDK works for 3 years from its release. As the SDK comes with a monthly or yearly subscription, this guarantees that everyone runs an up-to-date, supported version, and leaves plenty of time to update. Your program warns you 60 days before; then download the latest version from this website, free with your subscription. Your code does not need to change.
No license needed for demo accounts: check that the SDK works with your broker before you buy.
Trading involves a high risk of loss. MTsocketAPI is a software tool, not investment advice: always test your programs on a demo account first. You are responsible for the orders your software sends. See the Terms of Service.
Created with Mobirise
Web Site Maker