1024 / MQL5 / USDⓈ-M FUTURES
How can MQL5 switch Binance Multi-Assets Mode?
Call ufChangeMultiAssetsMode with the string true or false. On its first timer event, this example requests enabling Multi-Assets Mode, then disabling it, and parses both responses. This changes account mode rather than an ETHUSDT-only setting.
What do you need to use this example?
- Install and configure MT5 Binance and API credentials. Make mt5binance.mqh, JAson.mqh and the account permissions required by this example available.
- The account must meet mode-change requirements and have appropriate API permissions. This source’s OnInit only sets symbol and the timer; it does not perform the credential, curl-handle or buffer initialization used in other examples. Integration must supply the preparation required by the installed library and environment.
How does the source execute?
- OnInit sets symbol="ETHUSDT" and calls EventSetTimer(1); OnTick is empty.
- The first OnTimer calls runDemo when isRun==false and requests ufChangeMultiAssetsMode(..., "true", ...) followed by "false".
- Set isRun=true and handle ACCOUNT_CONFIG_UPDATE in OnChartEvent. Determine the final mode from the actual successful responses.
Run the demo on the first timer event; isRun prevents repetition. EventSetTimer(1) specifies a one-second interval.
Parameters and execution behavior
| Parameter | Source value or behavior |
|---|---|
| Main interface | ufChangeMultiAssetsMode |
| Timer interval | 1 s |
| First request | "true" |
| Second request | "false" |
| Scope | Account mode |
| Event | ACCOUNT_CONFIG_UPDATE |
| Request timing window | recvWindow = 3000 ms |
| Execution trigger | Run the demo on the first timer event; isRun prevents repetition. EventSetTimer(1) specifies a one-second interval. |