Skip to content
All library documents

Using PCA Eigenvectors to Select Portfolios in MQL5

Article MQL5 articles

Summary

The article introduces principal component analysis as a way to reduce the dimensions of data while retaining directions that explain much of its variance. It reviews eigenvectors and eigenvalues, compares PCA with singular value decomposition and power iteration, and outlines a workflow: normalize the data, compute a covariance matrix, find its eigenvectors and eigenvalues, then project the original returns onto the resulting directions. The largest eigenvalue identifies the direction that captures the greatest variance in the sample.

An MQL5 example applies this process to alternative allocations among three ETFs, using historical returns to compare portfolios. The author interprets the projection weights and associated eigenvalues to identify which portfolio is most aligned with dominant patterns in the data, and suggests normalizing eigenvalues and setting thresholds when combining results from multiple analyses. The article presents dimensionality reduction as a tool for visualization, computation, and noise management, while recognizing a trade-off between simpler representations and retained information. It does not establish out-of-sample performance or show that the selected allocation will remain suitable in future markets.

Key ideas

  • PCA reduces data dimensions by representing observations along directions that capture variance.
  • The described workflow normalizes returns, computes covariance, and obtains eigenvectors and eigenvalues.
  • An eigenvector associated with a larger eigenvalue represents a direction explaining more sample variance.
  • The MQL5 example compares alternative allocations across three ETFs using projected historical returns.
  • Dimensionality reduction may simplify analysis, but the article does not demonstrate future portfolio performance.

Tags

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