MetaTrader 5 Python User Group - the summary - page 38

 

Feature Engineering for ML (Part 9): Structural Break Tests in Python

Feature Engineering for ML (Part 9): Structural Break Tests in Python

The preceding articles in this Feature Engineering for ML series built features from the structure of time itself: Part 1 established fractional differentiation as a way to preserve long memory in a stationary series; Part 3 embedded the trading calendar into Fourier coordinates; and Part 5 compressed tick-level order flow into bar-indexed microstructural statistics. This article builds features from a qualitatively different question: not what the current bar looks like, but whether the data-generating process that produced it has recently changed.

Feature Engineering for ML (Part 9): Structural Break Tests in Python
Feature Engineering for ML (Part 9): Structural Break Tests in Python
  • 2026.07.03
  • www.mql5.com
We present a production‑ready implementation of AFML Chapter 17 structural break tests. The module includes Chu-Stinchcombe-White (one-/two-sided), Chow-type DFC, SADF across six models (linear, quadratic, sm poly 1, sm poly 2, sm exp, sm power), plus QADF (q, v) and CADF (q), returning bar-indexed scalar features. We address the book snippets' scaling issues and argument‑order pitfall, and show how a fixed lookback (L=504) bounds SADF cost to O(L²) per bar for regime detection.