Skip to content
All library documents

Account-Level Trading Risk Controls for Position Sizing and Loss Limits

Article MQL5 code base

Summary

This document describes Risk Guard, an account-level tool that monitors positions opened manually or by other trading systems. It does not generate trades. Its controls include risk-based lot-size estimates, a daily loss threshold, a cap on open positions, reduction of oversized trades, forced stop-loss placement, and a spread warning. The sizing calculation uses symbol-specific tick values, tick sizes, and volume steps, with risk set as a balance percentage or fixed amount.

The daily threshold combines closed profit and loss since server midnight with current floating profit and loss. When reached, the tool can close positions and block newly opened ones until the next server day; the lock is stored across terminal restarts. The document reports a Strategy Tester demonstration on EURUSD in which a harness exercised missing stops, excessive position size, too many positions, and the daily lock, with five checks passing. This is a limited, single-symbol test, not evidence of live-market reliability. Results also depend on configuration, platform behavior, and broker execution.

Key ideas

  • The tool monitors account positions but does not open trades.
  • Lot sizing estimates permitted volume from a chosen risk amount and stop distance.
  • A daily loss lock combines realized results since server midnight with floating P/L.
  • Position limits, oversized-trade trimming, and forced stops enforce configured constraints.
  • The reported verification is a single Strategy Tester setup and does not establish live performance.

Tags

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