Source code
ONNX in an MT5 EA: inputs, shapes and repeatable predictions
A model can load successfully and still receive unsuitable inputs. Feature order, shape, data type and preprocessing must match the model’s expected contract. Treat that contract as part of the strategy.
Write a feature manifest
List every input feature in order, its unit, lookback and normalisation rule. Keep the model file version beside that manifest. A price in raw units and a scaled return are not interchangeable inputs.
Use a known sample
Prepare one fixed input and its expected output from the model’s development environment. Compare the terminal result before connecting it to live market events. Allow only a documented numeric tolerance.
Check failure behaviour
Decide what happens if the model fails to run, a shape is wrong or data is missing. Do not replace a failed prediction with an arbitrary buy or sell value. Record the failure without flooding the log.
Keep changes traceable
When you change preprocessing or the model, repeat the fixed-sample check. Source access helps you inspect this boundary, but it does not reveal the quality of a model’s training data by itself.
Start with a free editable EA project · Explore MQLume source code
Back to top