Skip to content
All library documents

Preparing and Deploying ONNX Time-Series Models in MQL5

Article MQL5 articles

Summary

This article discusses practical steps for deploying machine-learning models through ONNX in MQL5, with attention to scaling, dimensionality reduction, and time-series inputs. It explains why features on different scales can impair distance calculations, optimization, or numerical stability, and describes min-max scaling and standardization. The scaler must be fitted on training data and reused for test and deployment data so the model receives a consistent feature representation.

The example workflow collects daily OHLC data, derives a directional label from whether a bar closes above or below its open, standardizes input features, saves scaler parameters, and exports the prepared dataset. It also describes forming fixed-length sequences for recurrent models such as LSTMs, and introduces PCA as a dimensionality-reduction approach. The text provides implementation guidance rather than a complete empirical evaluation: the visible material gives no measured forecast accuracy or evidence that the sample labeling scheme is profitable. Successful deployment still requires reproducing preprocessing and tensor preparation across Python and MQL5.

Key ideas

  • Fit feature scaling on training data and reuse those parameters for testing and deployment.
  • The example separates OHLC inputs from a directional label before scaling the features.
  • The workflow saves scaler parameters and scaled data so model preparation can be carried across Python and MQL5.
  • Recurrent time-series models require observations to be organized into fixed-length sequences with corresponding targets.
  • The article describes implementation techniques but does not establish predictive or trading performance.

Tags

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