Skip to content
All library documents

Building a Daily Drawdown Limiter for MetaTrader 5

Article MQL5 articles

Summary

The article explains a MetaTrader 5 Expert Advisor that monitors account activity and displays a daily drawdown dashboard. Its approach derives the day's starting balance from the current balance and that day's closed deal profit, commission, and swap, then compares daily losses and equity decline against configured limits. It also describes tracking account balance, equity, and currency, refreshing checks on new bars, and showing status through chart labels and traffic light indicators.

The example presents thresholds of 5% for daily drawdown and 12% for overall equity decline, with trading permission switched off when either limit is reached. The tool is intended to oversee manual trades and trades from other EAs as well as help prevent overtrading. The article focuses on implementation and interface behavior; it gives no performance evaluation or evidence that the thresholds suit a particular account or funding firm's rules. Some code and the tick handler are omitted, so the description alone is not a complete, verified implementation.

Key ideas

  • A daily loss check can reconstruct the opening balance by subtracting the day's closed trade results from the current balance.
  • The example blocks further trading after either a daily loss threshold or an overall equity drawdown threshold is crossed.
  • The EA presents account status, drawdown figures, and trade permission through chart labels and visual indicators.
  • Account checks are organized around new bars to avoid repeating the trading logic on every tick.
  • The example's thresholds are configurable policy choices, and the article provides no performance validation.

Tags

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