Skip to content
All library documents

Combining Regression and Classification ONNX Models in MQL5

Article MQL5 articles

Summary

The article demonstrates a voting-style ensemble that runs two separately trained EURUSD daily models inside an MQL5 Expert Advisor. One model uses recent OHLC observations to predict the next close; the other classifies movement as up, down, or approximately unchanged from a sequence of closes. Their outputs are mapped to directional classes, and the EA accepts a prediction when the selected models agree, otherwise withholding a combined signal. The example also shows normalization, ONNX export, model loading, and choosing either model or both.

Reported testing suggests the classification model performed better than the regression model, but the article provides no detailed metrics in the supplied text. Both models are explicitly demonstrations, and the EA is not intended for live trading. The setup is limited to one currency pair and daily bars, and the examples do not establish that agreement improves out-of-sample returns, controls risk, or generalizes to other markets. Its primary contribution is an implementation pattern for combining ONNX predictions in MQL5.

Key ideas

  • A regression model predicts a future closing price, while a classifier assigns an up, down, or near-unchanged class.
  • The two models use different lookback lengths and different input features, with prices normalized before training.
  • The ensemble can use either model alone or accept a combined prediction only when model outputs agree.
  • The article reports that the classifier tested better, but gives no detailed performance figures in the provided text.
  • The models and Expert Advisor are demonstrations and are not presented as ready for live trading.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.