Skip to content
All library documents

Adaptive Position Sizing with Generalized Kelly and Bootstrap Risk Limits

Article MQL5 articles

Summary

This MQL5 prototype separates trade sizing from signal generation and uses trade outcomes expressed as R-multiples: realized profit or loss divided by initial monetary risk. From those outcomes, it calculates distribution and downside statistics, estimates a generalized Kelly growth fraction, and adjusts risk for volatility conditions and recent performance. An iterative bootstrap Monte Carlo calibration searches for a risk fraction that meets configured drawdown and ruin probability limits. Exposure caps and broker-specific lot constraints apply before a final size is returned.

The article outlines modular components for statistics, edge estimation, simulation, policy adjustments, lot calculation, and decision logging. It emphasizes that MQL5 history does not contain each trade’s initial monetary risk, so valid R-multiples must be supplied separately. The ulcer index is calculated on a synthetic equity curve and is described as a sequence comparison proxy, not a forecast of actual drawdown. Calibration on the same trades used to estimate the edge can overstate confidence; the author recommends walk-forward or out-of-sample validation. The prototype describes a risk workflow, not proof of superior live performance.

Key ideas

  • Trade outcomes need initial monetary risk to be converted into comparable R-multiples.
  • The engine combines empirical Kelly sizing with volatility and recent-performance adjustments.
  • Bootstrap simulations calibrate risk against configured drawdown and ruin constraints.
  • Exposure limits and broker rules constrain the final lot size.
  • In-sample calibration can overstate safety, so out-of-sample validation is recommended.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.