Discussing the article: "Change Point Detection for Financial Time Series in MQL5"

Check out the new article: Change Point Detection for Financial Time Series in MQL5.

Financial markets can shift between regimes, so detecting when the statistical behavior of returns changes is valuable for analysis. An MQL5 change point detector segments historical returns into periods with different mean and volatility using optimal partitioning with PELT pruning and a BIC-style default penalty. A sensitivity scan tests robustness by showing which detected breaks persist as settings vary.

Financial returns do not behave the same way throughout a history. A market that trends smoothly for months may move into a highly volatile phase after an announcement, and the mean and variance of its returns can shift with it. The task in this article is to divide a return history into segments with different mean and variance, in a repeatable way, and to ask at which points the modeled behavior of returns changed enough that treating them as one continuous regime stops being a good fit.

The solution combines a Gaussian segment cost, a fixed penalty per change point, and the Pruned Exact Linear Time (PELT) algorithm, implemented as four cooperating MQL5 classes. PELT finds the optimal segmentation exactly, discarding candidate break points once they can no longer be optimal, provided a condition on the cost holds, which the script checks before it prunes.

Author: Kayode Michael Oyetunde