Discussing the article: "Marginal Drawdown Contribution Analyzer in MQL5: Which Configuration Deepens Your Portfolio Drawdown"

Check out the new article: Marginal Drawdown Contribution Analyzer in MQL5: Which Configuration Deepens Your Portfolio Drawdown.

We show how to attribute realized portfolio drawdown to individual configurations inside MetaTrader 5. Using daily results grouped by magic (optionally magic and symbol), the tool rebuilds the portfolio curve and quantifies three contributions: leave-one-out drawdown, shares of the deepest drawdown episodes, and Euler variance share. Flags are checked for stability across sample halves and rolled up into a heuristic A+–F score for practical diagnostics.

A trader who runs several Expert Advisors on one account, or one Expert Advisor with many configurations, usually knows each component well. Each one has passed its own backtest, and each one has its own drawdown figure. The account, however, trades one portfolio, and the portfolio has a single equity curve with a single maximum drawdown.

The data the trader actually has is the deal history of the account in MetaTrader 5, where every deal carries a magic number. This leads to a practical question: which configuration contributed most to the realized portfolio drawdown, and which one offset it? A standalone drawdown metric cannot answer this because it ignores timing. A pairwise correlation matrix cannot answer it either because it describes pairs of configurations, not the relation of one configuration to the whole portfolio.

I run a book of several dozen configurations on one account, and this question comes up every time a configuration is added or retired. In this article, we build a tool that answers it from the deal history. By the end, you will have a working Marginal Drawdown Contribution Analyzer that:

Everything runs natively inside MetaTrader 5. No external libraries, no Python, no AI.

This article builds on earlier tools in the same area. The Multi-EA Portfolio Scorer reports standalone drawdowns and pairwise correlations. The Drawdown DNA Analyzer decomposes a single equity curve into episodes. The Random Matrix Theory article denoises the correlation matrix of symbol returns. None of them builds the combined portfolio curve and attributes its drawdown to the components, which is the subject of this article.

Author: Cristian David Castillo Arrieta