Most "my ONNX model won’t load in MT5" problems are visible before you ever call OnnxCreate — in the model file itself. Netron is a free viewer that shows you the exact inputs, outputs, shapes, dtypes and opset your .onnx file exposes. Five minutes here saves hours of MQL5 debugging.

Note

Netron runs in the browser at netron.app (nothing to install) or locally via pip install netron then netron model.onnx. Your model never leaves your machine in the local version.

Open the model

Drag your .onnx file into netron.app, or run it locally. You’ll see the graph: the input node(s) on top, the operations in the middle, and the output node(s) at the bottom. Click any node to inspect it.

Read the input tensor

Click the input node. Note three things, because MQL5 has to match them exactly:

Check the opset version

Click the top-level graph background; the sidebar shows the opset (imports). For MetaTrader 5 in 2026, opset 17 is the safe default. Much newer opsets can contain operators MT5’s ONNX Runtime doesn’t support yet. See the opset version guide.

Spot the dynamic axes

If sequence length is dynamic when it should be fixed, inference in MT5 can silently produce wrong outputs. Confirm only the axes you intend (usually just batch) are dynamic — the rest should be concrete numbers. Background: dynamic_axes explained.

Runtime parity check

Netron shows structure; it doesn’t prove correctness. Confirm the exported model returns the same numbers as your framework by running both on one input and comparing:

import numpy as np, onnxruntime as ort
sess = ort.InferenceSession("model.onnx")
onnx_out = sess.run(None, {"input": x.astype(np.float32)})[0]
# compare against your framework output on the same x
np.testing.assert_allclose(fw_out, onnx_out, rtol=1e-3, atol=1e-4)

If this passes on the desktop but MT5 disagrees, the culprit is almost always a shape, dtype, or normalization mismatch — not the model.

When Netron reveals the bug

A wrong input name, an unexpected int64, an over-new opset, or an accidentally-dynamic sequence axis are the four things that most often turn into ERROR 5800 once the file reaches MetaTrader 5. Catch them here first.

Frequently asked questions

Is Netron safe for a proprietary model?

Yes. The local version (pip install netron) never uploads your file; it renders the graph on your own machine. The web app also processes the file in your browser.

What should I check in Netron before loading in MT5?

Input/output names, shapes and dtypes, the opset version (17 is the MT5-safe default in 2026), and whether any axis is unexpectedly dynamic.