Discussing the article: "MetaTrader 5 Machine Learning Blueprint (Part 25): Live Monitoring"

Check out the new article: MetaTrader 5 Machine Learning Blueprint (Part 25): Live Monitoring.

The article shows why a fixed posterior threshold, checked trade by trade, lacks error control and retires healthy strategies far too often on a real EURUSD case. It introduces WinRateSPRT (with Page's CUSUM for continuous use) and a permutation-tested profit factor trend to cover distinct failure modes. LiveStrategyMonitor integrates both and reports a normalized retirement-progress measure for operational decisions.

Beyond its constructors, afml.strategies.learned_strategies.LearnedStrategy exposes generate_signals, get_strategy_name, and get_objective. None of them accepts a trade outcome. Once a strategy is deployed there is no place for a closed trade to go and no object that tracks whether the strategy is still working. The concerns of Part 24 carry over after deployment, where the evidence arrives one trade at a time and the incentive to keep a losing strategy running is strongest.

The obvious fix looks statistical: after every trade, compute the posterior probability that the true win rate has fallen below its historical value, and retire the strategy the first time that probability crosses 95%. The statistic is standard, since a Beta posterior on a Bernoulli win rate is textbook. The procedure built around it is not, and Section 3 measures by how much at this series' own win rate.

This article implements three components in afml.monitoring. First, WinRateSPRT, a sequential probability ratio test with two modes: Wald's terminating test for a one-shot decision on a fixed batch, and Page's reflecting CUSUM for continuous monitoring. Helper functions compute the CUSUM's false-alarm probability over a planned horizon and set its boundary to hold that probability at a chosen level. Second, profit_factor_trend, a resampling trend test on granular profit factor, aimed at a failure mode a win-rate test cannot see. Third, LiveStrategyMonitor, which composes both into the post-deployment interface the pipeline was missing.

Author: Patrick Murimi Njoroge