This article implements a PSI-based drift watchdog for MQL5 EAs. It compares a feature and the model's predicted probability against a quantile-based reference using a rolling window at a configurable cadence, applies hysteresis to avoid flapping, and raises a webhook on state transitions. You get tested math, an audit CSV and a plotting indicator, plus tuning guidance for thresholds, window size, and cooldown.
A model goes stale when its live inputs move away from the distribution it was trained on, and most of us only find out from the equity curve. This article builds a lightweight MQL5 watchdog that compares a rolling sample with a captured reference using the Population Stability Index (PSI), logs every reading, and sends a webhook when the monitoring state changes.
The implementation has one PSI monitor class, a webhook client, an EMA-cross demonstration EA and a companion indicator. Two monitors track a normalized RSI and a sigmoid-transformed EMA spread as stand-ins for a model feature and a model prediction. Validation has three separate parts: independently calculated PSI cases, a EURUSD H1 backtest, and a webhook-delivery test from a live/demo chart.
PSI measures distribution change, not model accuracy or trading performance. A DRIFT alert is a request to investigate, not evidence that the model has failed or should automatically be retrained. Conversely, a stable PSI does not guarantee that the strategy retains its edge. It also says nothing about why the distribution moved.
What you get is a cheap, continuous tripwire that behaves the same on any symbol, and a webhook so it can talk to a retraining job, a Telegram bot or a dashboard. The code is symbol-agnostic; the thresholds and windows are not, so expect a calibration pass on each instrument, as with any threshold-based system.
Check out the new article: Model Drift Watchdog: PSI-Based Auto-Retrain Alerts via a Lightweight Webhook.
A model goes stale when its live inputs move away from the distribution it was trained on, and most of us only find out from the equity curve. This article builds a lightweight MQL5 watchdog that compares a rolling sample with a captured reference using the Population Stability Index (PSI), logs every reading, and sends a webhook when the monitoring state changes.
The implementation has one PSI monitor class, a webhook client, an EMA-cross demonstration EA and a companion indicator. Two monitors track a normalized RSI and a sigmoid-transformed EMA spread as stand-ins for a model feature and a model prediction. Validation has three separate parts: independently calculated PSI cases, a EURUSD H1 backtest, and a webhook-delivery test from a live/demo chart.
PSI measures distribution change, not model accuracy or trading performance. A DRIFT alert is a request to investigate, not evidence that the model has failed or should automatically be retrained. Conversely, a stable PSI does not guarantee that the strategy retains its edge. It also says nothing about why the distribution moved.
What you get is a cheap, continuous tripwire that behaves the same on any symbol, and a webhook so it can talk to a retraining job, a Telegram bot or a dashboard. The code is symbol-agnostic; the thresholds and windows are not, so expect a calibration pass on each instrument, as with any threshold-based system.
Author: Olamide Daniel Adebayo