Skip to content
All library documents

MQL5 Portfolio Monitoring with Drawdown Alerts and Mitigation

Article MQL5 articles

Summary

The article extends an MQL5 portfolio dashboard with strategy-level drawdown tracking, threshold alerts, protective actions, trade exports, and an asynchronous AI review. Its heatmap calculation processes trades chronologically for each strategy, tracks equity peaks, and records the decline from each peak at trade exits. The author notes that profit, swap, and commission should all contribute to the reconstructed result, since an account-wide equity curve can conceal risk in individual strategies.

When configured limits are breached, the system can close positions and delete pending orders, set a terminal global variable for selective blocking, or disable AutoTrading across the terminal. It can also export trade history and metrics and request AI-generated risk analysis. The article describes the implementation but does not provide independent evidence that the alerts improve returns or that the AI recommendations are reliable. It requires Windows, enabled DLL imports, and Python for AI review; disabling AutoTrading affects every Expert Advisor on the terminal.

Key ideas

  • Track strategy drawdown separately by accumulating trade results in chronological exit order.
  • Measure drawdown as the distance between current strategy equity and its running peak.
  • Threshold breaches can trigger position closure, selective software blocks, or terminal-wide AutoTrading disablement.
  • CSV and formatted workbook exports support reporting and further analysis.
  • The AI review runs asynchronously through a Python process and has Windows and DLL requirements.

Tags

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