All about MQL5 Wizard : create robots without programming. - page 12

 

MQL5 Wizard Techniques you should know (Part 87): Volatility-Scaled Money Management with Monotonic Queue in MQL5

MQL5 Wizard Techniques you should know (Part 87): Volatility-Scaled Money Management with Monotonic Queue in MQL5

This article proposes a practical, deployable remedy: a zero-lag money-management pipeline that (1) computes Donchian-style range extremes in O(N) using a Monotonic Queue (deque) to eliminate sliding-window latency, and (2) applies a lightweight Radial Basis Function (RBF) gatekeeper to nonlinearly validate signal quality before finalizing lots. The deliverable is a ready‑to‑integrate MQL5 module (CMoneyMonotonicQueueRBF::Optimize) with tunable inputs (window size, m base volatility, use rbf) that (a) produces an instantaneous current volatility, (b) computes scale factor = base volatility / current_volatility, (c) normalizes lots to broker step/min/max, and (d) — optionally — multiplies by an RBF output in [0,1]. The approach targets EA developers who require preventive, real‑time risk scaling and a reproducible test protocol for Strategy Tester comparisons.
MQL5 Wizard Techniques you should know (Part 87): Volatility-Scaled Money Management with Monotonic Queue in MQL5
MQL5 Wizard Techniques you should know (Part 87): Volatility-Scaled Money Management with Monotonic Queue in MQL5
  • 2026.04.30
  • www.mql5.com
This article presents a custom MQL5 money management class that adapts position sizing to real-time volatility using a monotonic queue for O(N) sliding-window extremes. The class applies inverse volatility scaling and optionally validates risk with an RBF network. We show implementation details in the Optimize method and compare results with the inbuilt Size-Optimized class to assess latency and risk control benefits.