Discussing the article: "The MQL5 Standard Library Explorer (Part 15): Building a Market-Regime Classifier with dataanalysis.mqh"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: The MQL5 Standard Library Explorer (Part 15): Building a Market-Regime Classifier with dataanalysis.mqh.
This part focuses on practical data analysis in MQL5 with dataanalysis.mqh. We prepare a labeled dataset from bars, apply normalization, explore redundancy with PCA, and train a decision forest to classify future bar regimes. The article shows how to obtain out-of-bag estimates and permutation importance, helping you validate the model and understand which inputs matter most.
This is where dataanalysis.mqh becomes important.
This file is one of the largest components in the MQL5 ALGLIB port. It brings together algorithms for preprocessing, classification, regression, clustering, dimensionality reduction, neural networks, time-series analysis, and nearest-neighbor methods. Rather than studying all of these algorithms as isolated mathematical demonstrations, we will approach the library from the perspective of an algorithmic trader.
Our objective is to build a structured dataset from market bars. We will normalize the variables, inspect structure with Principal Component Analysis (PCA), and train a decision forest to classify each observation by the next completed bar's close-to-close return:
In this article, regime is shorthand for one of these next-close directional classes; it does not mean a complete trend, range, or volatility regime. The important lesson is not that a random forest can predict every next close. It cannot. The purpose is to show how dataanalysis.mqh supports a self-contained training and analysis pipeline in MQL5. The script demonstrates preprocessing, Principal Component Analysis, model fitting, and diagnostics; it is not presented as a production pipeline with chronological validation, model persistence, or live inference.
Author: Clemence Benjamin