MT5 Binance MQL API guide
The software wraps the official Binance API in MT5 so you can trade Binance directly through MQL.
Core features of mt5binance.mqh
The software exposes Binance APIs in MQL through the header file in your MT5 installation directory:\MQL5\Include\mt5binance.mqh. This enables direct Binance trading through MT5.
Core principle — Matching the official Binance API
The mt5binance.mqh MQL interfaces and the official Binance APIs have a one-to-one correspondence
The parameters used by mt5binance.mqh and the official Binance API are identical
mt5binance.mqh returns the data supplied by the Binance API,without intermediate modifications
Use the official Binance API documentation as the software’s development reference
For example, the MQL interface ufNewOrder corresponds to the official Binance USDⓈ-M futures new order API
// USD-M futures new order interface
void ufNewOrder(int &handles[],
string symbol, // Symbol, e.g. "BTCUSDT"
string side, // Order side: "BUY" or "SELL"
string positionSide, // Position side: "LONG", "SHORT", "BOTH"
string type, // Order type: "LIMIT", "MARKET", etc.
string timeInForce, // Time in force: "GTC", "IOC", "FOK", "GTD"
string reduceOnly, // Reduce only: "true" or "false"
double quantity, // Order quantity
double price, // Order price (use 0 for market orders)
string newClientOrderId, // Client order ID
string newOrderRespType, // Response type: "ACK", "RESULT", "FULL"
string priceMatch, // Price matching mode
string selfTradePreventionMode, // Self-trade prevention mode
long goodTillDate, // GTD order auto-cancel time
long recvWindow, // Request timing window
char &result[]); // Response data
Official Binance USDⓈ-M futures new order API:
https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-usd-s-m-futures/api/rest-api/trade#new-order
For example, the MQL interface spAccountInformation corresponds to the official Binance spot account information API:
// Spot account information query interface
void spAccountInformation(int &handles[],
long recvWindow, // Request timing window
char &result[]); // Response data
Official Binance spot account information API:
https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#get-account
Therefore, the official Binance API documentation is the MQL development documentation for this software
mt5binance.mqh fully wraps the Binance spot, USDⓈ-M futures and COIN-M futures APIs, with parameters and return values matching the official APIs. Developers can refer directly to the official Binance documentation to develop quantitative trading strategies in MQL.
Supported API categories
The MQL interfaces cover these three Binance API categories:
Spot API
Spot interfaces such as spAccountInformation, spNewOrder and spCancelOrder cover Binance spot trading functions.
USDⓈ-M futures API
USDⓈ-M futures interfaces such as ufNewOrder, ufQueryOrder and ufGetPosition support leverage settings and Hedge Mode.
COIN-M futures API
COIN-M interfaces such as cfNewOrder, cfQueryOrder and cfGetAccountInfo support futures margined in cryptocurrency.