Implementing Four Bet-Sizing Methods in MQL5
Summary
The article translates four bet-sizing approaches from a Python module into an MQL5 system: probability-based sizing, sizing from forecast-price divergence, budget-constrained sizing, and reserve sizing learned from data. It outlines a layered design with shared statistical utilities, low-level sizing functions, orchestration APIs, and an Expert Advisor that selects a method and returns a signed position size with diagnostics. The described utilities include normal distribution approximations, moment calculations, and concurrency counts for overlapping bets.
For concurrency, it replaces repeated interval scans with a sorted-event sweep-line method; probability sizing still averages signals over active intervals. Reserve sizing fits a two-Gaussian mixture using multi-start estimation from raw moments and selects the candidate with the strongest likelihood. The article gives implementation details and code excerpts, but this is a programming blueprint rather than a trading performance study. It reports numerical accuracy for its distribution approximations and expected algorithmic complexity, while offering no empirical evidence that the sizing methods improve returns. Its applicability is also bounded by the assumptions and input quality of the underlying signals and fitted distributions.
Key ideas
- Probability sizing converts classifier confidence into exposure while accounting for overlapping bets.
- Dynamic sizing maps forecast-price divergence to a position and can provide a limit price.
- Budget and reserve sizing address exposure decisions when direct confidence scores are unavailable.
- A sweep-line event counter computes concurrent long and short bets from time intervals.
- The MQL5 design uses shared statistics utilities, method-specific functions, and a common diagnostic result.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.