Discussing the article: "Measuring What Matters (Part 5): The Risk Concentration Indicator — Plotting Eigenvalue Dominance Live"

Check out the new article: Measuring What Matters (Part 5): The Risk Concentration Indicator — Plotting Eigenvalue Dominance Live.

This article presents a live MQL5 indicator for monitoring portfolio risk concentration through eigenvalue decomposition. The indicator calculates rolling covariance statistics for three instruments using persistent prefix sums, aligns price data by timestamp, handles missing observations, and plots the dominant eigenvalue as a percentage of total portfolio variance. The implementation provides a practical way to observe changes in portfolio risk concentration as the covariance structure evolves over time.

Every script built in this series so far has answered a question about a fixed window of historical data. You run it, you read the output, you close it. That is useful for understanding the risk structure of a portfolio at a point in time. It is not useful for trading, because risk concentration does not stay fixed. The estimated covariance relationships between instruments change as the rolling window moves through different market regimes — correlations spike during macro events, compress during quiet periods, and reverse during risk-off episodes. A trader who checks their portfolio's eigenvalue spectrum once a week may be carrying substantially higher risk concentration for days before they detect the change.

Part 5 solves this by converting the eigenvalue analysis into a live indicator. RiskConcentrationIndicator.mq5 plots the dominant eigenvalue's percentage of total portfolio variance as a continuous histogram in a separate window — blue bars when concentration is within acceptable bounds, red bars when it has crossed the alert threshold. The histogram updates on each calculated bar, giving the trader a continuous view of how concentrated their portfolio risk is over time.

It's worth being precise about what "portfolio" means here: the calculation treats the three instruments as an equally-weighted, unit-exposure basket. It measures how concentrated the variance is within the covariance structure of the three return series themselves — not in a specific portfolio's actual position sizes, currency exposures, or contract multipliers. That layer is what Part 6 adds when it turns the eigenvectors into position weights.

Author: Kayode Michael Oyetunde