ONNX in MetaTrader 5: the working playbook.
Everything you need to load, run, and ship an ONNX model inside an MQL5 Expert Advisor — the right way. Build 5572 brought native CUDA acceleration, eight selectable GPU devices, and a profiling JSON. This is the silo that documents all of it, with code that compiles and error messages that get fixed.
The MQL5 ONNX API, demystified.
The official MetaQuotes docs tell you the function signatures. They don't tell you which flag changed in Build 5572, why OnnxRun silently falls back to CPU, or how to read the new profiling JSON. We do.
Start here
What Build 5572 changed for ONNX + CUDA
The Jan 2026 update added GPU acceleration to ONNX in MQL5. New flags, new behaviors, new gotchas. Everything documented.
read →OnnxCreate, SetInputShape, OnnxRun: the cheat-sheet
Working MQL5 code that loads, configures, runs and releases an ONNX session. With the new flags. No fluff.
read →CUDA-compatible GPU list for MT5
Turing and up. What "Turing and up" actually means in 2026 hardware, with the cards that work and the cards that throw CUBLAS_STATUS_ARCH_MISMATCH.
Verify your EA is actually using the GPU
By default, ONNX Runtime picks an execution provider silently. Three ways to confirm CUDA is running — and what to do when it isn't.
read →Reading the ONNX profiling JSON
Build 5572 added ONNX_ENABLE_PROFILING. The JSON it dumps is dense. Here's how to spot slow nodes, CPU/GPU transitions, and ops eating your latency.
Every ONNX error in MQL5, with a fix
One page per error message. Bookmark this for the day your model refuses to load and the log gives you four lines of stack trace.
read →The flag cheat-sheet (Build 5572).
If you remember nothing else from this site, remember these.
One step deeper: pick where the model runs.
Local workstation, GPU cloud, or forex VPS? They aren't interchangeable — one of them can't run CUDA at all.
Compare the three options →