Isolation Forest: execution-quality circuit breaker in pure MQL5
IsoForestExecMonitor scores each opening fill against a rolling Isolation Forest trained on the EA’s own recent execution history. On anomaly it can cool down new entries, widen open stops, or halt when the rolling anomaly rate trips. Monitor layer, not a signal — it does not predict price direction.
What the article ships
MQL5 · native IFAttached MQL5.zip: IsoForestExecMonitor.mq5 (host EMA-cross + monitor), IsoForest.mqh (CIsoTree / CIsoForest), ExecFeatureLogger.mqh (rolling buffer + CSV), and iso_forest_crossvalidation.py for offline synthetic checks. No ONNX, ALGLIB, or external DLL.
OnTradeTransaction → feature vector → AnomalyScore → cool-down / widen / halt
IF monitor vs Nested CV vs oos-lab
choose- Use Isolation Forest execution monitor You already have (or are building) a live/demo EA and need multivariate surveillance of fill quality — slippage, latency, spread-at-fill, volume deviation — with cool-down / widen / halt. Not for choosing price-signal hyperparameters.
- Use Nested CV You are selecting classifier hyperparameters and fitting a probability calibrator under temporal labels. Research-stack honesty before you trust an OOS return path.
- Use oos-lab / DSR calculator You already have return series (or a Sharpe + trials) and need PSR / Deflated Sharpe / PBO–CSCV / purged splitters. Complements the fill monitor; does not replace it.