Structural Break Tests in MQL5 for Machine Learning Features
Summary
This technical article ports several structural-change statistics to MQL5 for use as bar-indexed features in an expert advisor or indicator. The suite includes Chu-Stinchcombe-White CUSUM, a Chow-type Dickey-Fuller test, SADF with a rolling lookback, and sub- and super-martingale statistics. It explains the distinction between chronological indexing in Python and reverse time-series indexing in MetaTrader, and describes implementation choices such as log-price inputs, OLS accumulation, and precomputed squared differences.
The article frames the outputs as possible inputs to regime logic or machine-learning pipelines, including a CSW statistic compared with its critical value. It explains why rolling SADF reduces repeated computation relative to an expanding window, while noting that the rolling formulation changes the statistic’s interpretation. The included validation checks and Python–MQL5 comparison are implementation checks, not evidence of predictive trading performance. Test results depend on model specification, window choices, data handling, and interpretation of statistical thresholds.
Key ideas
- The MQL5 suite calculates multiple structural-break statistics for use as trading or machine-learning features.
- Log prices are used as inputs, and indexing must be mapped carefully between Python and MetaTrader time-series order.
- Precomputing cumulative squared differences reduces repeated work in the CSW calculation.
- A rolling SADF window lowers computation relative to an expanding window but changes the statistic’s interpretation.
- Numerical validation can check implementation consistency without establishing that features predict profitable trades.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.