Discussing the article: "Adaptive Position Sizing in MQL5: A Prototype Risk Engine with Generalized Kelly and Bootstrap Calibration"
The layer I would test hardest is the degradation model. On my own intraday setups I measured how much of a fresh deviation survives from one period to the next, per setup and market over eleven years. A cell that had just turned significant kept about 11 percent of its move in the following period, and the weakest fifth of cells in the first half of the sample went from -0.129 R to +0.003 R in the second half, plain regression to the mean. The structural part of the edge carried over with a beta of 0.90. A recent window that can be as short as ten trades, triggering at t 1.5, will mostly be reacting to the noise part and start cutting size at the point where my data says the cell tends to revert. My daily P/L series also has an autocorrelation of -0.02, so a bad stretch told me nothing about the next day. What held up for me was estimating on the full history and letting a recent window move the estimate only after shrinking it by roughly 90 percent. You already list the missing walk forward as a limitation, and this is the layer where I would expect it to bite: one run with the degradation layer on and one with it off.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Adaptive Position Sizing in MQL5: A Prototype Risk Engine with Generalized Kelly and Bootstrap Calibration.
This article presents a modular position sizing engine for MetaTrader 5 that operates on normalized R-multiples. A layered pipeline combines enriched trade statistics, a generalized Kelly edge estimate, volatility-aware adjustment, Monte Carlo calibration under ruin and drawdown limits, a continuous risk policy, an exposure guard, and a broker-aware lot calculator. The output is a broker-valid lot size with an optional CSV audit trail, providing a transparent prototype for implementing modern risk controls in native MQL5.
A typical Expert Advisor risks a fixed percentage of the account on every trade. This one-line rule ignores the strategy's statistical edge and current volatility. It also ignores drawdown paths that may not appear in a single historical backtest. As long as the strategy performs normally, a 1% fixed risk may be acceptable. During a deep drawdown, unusually volatile conditions, or a weak historical edge, that fixed percentage can be far too aggressive. Volatility inflates stops, a series of losses eats away at the safety margin, and the strategy's statistical advantage turns out to be weaker than it appeared in a single backtest.
The problem is not that 1% is too much or too little. The problem is that the position size is not based on the distribution of strategy outcomes and is not controlled by the probability of ruin or tail drawdowns. What is needed is a module separate from the signal logic that accepts normalized trade results in R-multiples and produces a risk fraction and lot size that shrink automatically in poor trading regimes and never exceed configured drawdown and ruin limits.
The engine described here replaces that fixed percentage with a layered, adaptive decision process. It works with R-multiples, defined as each trade's profit or loss divided by its initial monetary risk, so that all outcomes become comparable regardless of account size. From those normalized outcomes, the engine:
The project is presented as a research prototype: a complete, executable blueprint that shows how to combine these techniques in MQL5. It is not a turnkey institutional risk engine. Its limitations are documented, and every module can be extended or replaced.
Author: Stanley Kimathi Kibaara