Skip to content
All library documents

Measuring Portfolio Concentration with Spectral Entropy

Article MQL5 articles

Summary

This article turns the eigenvalue spectrum of a portfolio covariance matrix into a normalized diversification measure. It computes log returns for the instruments, builds a covariance matrix, extracts and sorts its eigenvalues, and converts them into shares of total variance. Shannon entropy of those shares is divided by the maximum entropy for the number of factors, producing a score from zero for concentration in one factor to one for an even distribution. The script also reports the largest factor’s share and compares two portfolios using the same lookback settings.

The examples contrast three US dollar currency pairs with a mix of currency and gold exposures. The article emphasizes that instrument labels alone do not establish diversification: the variance distribution determines the score. It gives illustrative spectra and a script output, but does not demonstrate that the score predicts losses or improves portfolio returns. Covariance reflects both correlation and relative volatility, and the suggested warning threshold is only a starting point requiring calibration to the assets and horizon.

Key ideas

  • Eigenvalues describe how portfolio variance is distributed across independent risk directions.
  • Normalizing eigenvalues into variance proportions allows Shannon entropy to measure concentration on a comparable scale.
  • A normalized entropy score approaches one when variance is evenly spread and zero when one factor dominates.
  • Portfolio comparisons should use consistent data horizons and settings.
  • Covariance-based entropy also reflects differences in instrument volatility, and thresholds need calibration.

Tags

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