ChangePoint.mqh detects changes in the mean or the volatility of a series as they happen, with the Bayesian online change point detection of Adams and MacKay (2007). The series is seen as segments, each with its own mean and variance, and a new segment can start at any bar. After each value the class gives the probability of every run length (the bars since the last change), so the probability that a change happened in the last k bars, the most likely start of the current segment, and the forecast of the next value. It works bar by bar (Update), so an Expert Advisor or an indicator can call it on each new bar. No DLL.
#include <ChangePoint\ChangePoint.mqh> CChangePoint cp; cp.Prior(0.0, 0.1, 2.0, 1.0); // segment mean around 0, variance around 1 (beta / (alpha - 1)) cp.Hazard(250.0, 1e-12); // a change every 250 bars on average; drop run lengths below 1e-12 // at each new closed bar: double ret = 0.0; // for example 100 * log(close[1] / close[2]) cp.Update(ret); double p = cp.ChangeWithin(10); // probability that the current segment is younger than 10 bars int run = cp.MostLikelyRun(); // bars since the most likely last change double next = cp.PredictiveStd(); // standard deviation of the next value
The indicator ChangePointProbability.mq5 draws, in a separate window, the probability of a change within the last k bars, computed once per closed bar from the returns up to that bar. The script ChangePointExample.mq5 runs the detector on the returns of a symbol and lists the changes it found (a change is reported once the new segment has lasted a few bars), with the volatility before and after, and the state now (picture 1). On gold D1 it finds the jump of volatility of April 2025 and the swings of early 2026 (picture 2).


ChangePoint.mqh goes to MQL5\Include\ChangePoint, ChangePointExample.mq5 to MQL5\Scripts\ChangePoint, ChangePointProbability.mq5 to MQL5\Indicators\ChangePoint.
MeanReversion: Ornstein-Uhlenbeck fit and optimal trading bands
Exact maximum likelihood of an Ornstein-Uhlenbeck spread and Bertram's optimal entry and exit levels for a given cost, with the expected length of a trade cycle.
Trade Excursion Report - MAE and MFE of your closed trades (script)
For every closed position the script measures how far the price went against it (MAE) and in its favour (MFE), and shows what that says about your stops and exits. Table, summary on the chart and a CSV file. Read-only, it never trades.
Copula: Gaussian, Student t, Clayton, Gumbel and Frank copulas with tail dependence
Fits five bivariate copulas on ranks, with Kendall's tau, tail dependence, the probability of joint extreme days, AIC and the conditional probabilities of pairs trading.
Supply Demand Zones
Supply and demand zones for Gold (XAUUSD), EURUSD and any symbol: zones from swing highs and lows sized by ATR, fresh or tested, merged, broken ones removed, alerts and 5 buffers for EAs. Open source code.