Skip to content
All library documents

Prop Trading Drawdown Controls with an Equity Monitoring Guard

Article MQL5 code base

Summary

This document describes an account protection utility for prop firm evaluations. It monitors equity against a daily loss threshold measured from a daily reset baseline and a total drawdown threshold measured from the highest equity since startup. A configurable buffer makes the guard act before either stated limit is reached. When a threshold is hit, it closes positions, cancels pending orders, and prevents further trading until the daily reset or, for total drawdown, indefinitely.

The guard polls account state so it covers manually opened trades and activity from other trading systems. It tracks state in memory; after a terminal restart, it resets the daily baseline to current equity. The document gives a self-test example in which repeated trades incur spread costs until the daily limit is breached, and describes journal logs for auditing. Limits include dependence on broker server time for the reset and possible close rejections that require retries. It enforces risk constraints but does not provide a trading edge.

Key ideas

  • The guard measures daily losses from reset-hour equity and total drawdown from the observed equity peak.
  • A safety buffer moves the intervention point inside the configured loss limits.
  • Equity monitoring captures floating losses and trades opened outside the guard's own strategy.
  • After a terminal restart, the daily baseline is re-anchored to current equity.
  • The tool controls exposure but does not make the underlying strategy profitable.

Tags

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