All public work

Public MQL5 CodeBase script

MT5 Cash Risk Probe

A read-only MetaTrader 5 script that estimates entry-to-stop cash loss in account currency, reserves explicit costs and floors volume to the broker grid without sending an order.

The engineering problem

Why this tool exists

A percentage-risk requirement is incomplete until account currency, entry, stop, cash reserve and the broker volume grid are frozen. The probe exposes that sizing boundary before execution logic is allowed to hide it.

Published capabilities

  • Hypothetical buy or sell loss through OrderCalcProfit()
  • Explicit account-currency budget and cash cost reserve
  • Broker minimum, maximum, step and volume-limit inspection
  • Offset-aware volume flooring and final-loss recalculation
  • Five deterministic volume-normalization self-tests
  • Read-only execution boundary with order_sent=false

Engineering evidence

  • Original MQL5 source and ZIP published in MQL5 CodeBase item #75981
  • MQL5 CodeBase Scripts classification, owned cover and structured limitations
  • Five deterministic self-tests passed in both installed MT5 terminals
  • Invalid connected-account state failed closed instead of inventing a volume

What this case study does not claim

  • A valid estimate does not guarantee fill price, commission, slippage, margin availability, trade-server acceptance or profit.
  • The connected-account runtime evidence proves safe failure, not a successful broker cash-risk calculation.
  • The script does not aggregate portfolio exposure and never sends or modifies an order.

Need related custom work?

EA Specification Audit39 €

Review scope and boundaries