Building a Three-Class Market Direction Classifier with MQL5 ALGLIB
Summary
This tutorial demonstrates a compact market-data learning pipeline using MQL5's ALGLIB data-analysis library. It converts OHLC bars into five numerical features—one-bar return, candle-body ratio, range ratio, and two momentum measures—and labels each observation by the following bar's close-to-close return as bearish, neutral, or bullish. It standardizes the input variables, uses principal component analysis to inspect the feature space, and fits a decision forest. The article also describes out-of-bag diagnostics and variable-importance analysis as ways to examine model behavior.
The author stresses that the labels represent only next-bar direction, not a broad market regime, and that the script is a training and analysis demonstration rather than a production or live-inference system. Reported diagnostics can help explore fit and feature contribution, but they do not replace chronological holdout or walk-forward validation. The article therefore provides a reproducible workflow concept for MQL5 research, not evidence that the classifier predicts reliably or supports profitable trades.
Key ideas
- Each observation uses five price-derived features and a label based on the next completed bar's return.
- A configurable threshold assigns small moves to a neutral class between bearish and bullish outcomes.
- Feature standardization and PCA are used before fitting a decision forest.
- Out-of-bag diagnostics and variable importance offer checks on fit and feature contribution.
- Chronological holdout and walk-forward validation are still needed before trading use.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.