Skip to content
All library documents

Cross-Platform Expert Advisor Money Management and Lot Sizing

Article MQL5 articles

Summary

This article describes a class-based approach to money management for Expert Advisors designed to work across MQL4 and MQL5. A shared base class calculates and returns trade volume, while derived classes implement different sizing rules. The article details fixed lot sizing, fixed fractional risk sizing based on account balance or equity, stop distance, and tick value, and fixed ratio sizing that adjusts volume as account size changes. A container is used to select among money-management objects dynamically.

The examples explain that fixed fractional sizing requires a stop loss and can produce impractical volumes when stops are unusually wide or tight. The article also discusses broker volume limits and platform differences, and shows example trade records for a cross-platform setup. These examples illustrate implementation rather than a controlled performance comparison. The sizing formulas depend on correct instrument tick data, account settings, and execution handling, and volume limits or missing stop information can affect the result.

Key ideas

  • A common base class can provide a consistent interface for multiple Expert Advisor position-sizing methods.
  • Fixed lot sizing keeps volume constant, while fixed fractional sizing scales risk to account value and stop distance.
  • Fixed fractional calculations require a nonzero stop and depend on accurate tick size and tick value data.
  • Fixed ratio sizing adjusts volume according to account growth thresholds and does not require a stop loss.
  • A container can support selecting among money-management methods dynamically across MQL4 and MQL5.

Tags

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