How to use the correlation matrix calculator
Choose the Assets tab for funds, ETFs, asset classes or stocks, and Trading strategies for the return streams of systems you run or are testing. Both work the same way; the strategy tab adds Sharpe ratios and shows how much combining the systems helps.
- Paste the returns table. The first line holds the names, separated by commas or tabs. Every following line is one period, oldest first, with one return in percent per column (1.5 means +1.5%). Columns copied from a spreadsheet, header included, paste directly. Every column must cover the same dates, with no blanks.
- Choose the frequency of the rows: monthly, weekly, daily or quarterly. It only affects the annualized volatility and Sharpe figures; correlations do not depend on it.
- Set the rolling window: the number of rows used for each point of the rolling chart. Twelve months is a common choice for monthly data, 60 to 120 days for daily data.
- Pick the pair to chart by column number, counting from 1 on the left.
The results show the average pairwise correlation, the most and least correlated pairs, the chosen pair’s full-period correlation and rolling range, and how volatile an equal-weight mix of all columns would have been. Below them are the colored matrix and a table of each column’s stand-alone statistics.
How the matrix is calculated
Each cell is the Pearson correlation of two return series:
ρ̄ = 2 ÷ [N(N − 1)] × Σi<j ρijri,t is the return of column i in period t and r̄i its average. ρ̄ is the average over all N(N − 1)/2 distinct pairs of N columns.
The equal-weight mix is rebalanced every period: its return is the simple average of the columns in that row. For strategies, the calculator also shows the standard result linking correlation to the Sharpe ratio of a combination:
SRmix = SR × √( N ÷ [1 + (N − 1) ρ̄] )Exact when every strategy has the same volatility σ and Sharpe ratio SR and every pair has correlation ρ̄; a good approximation otherwise. As N grows, SRmix approaches SR ÷ √ρ̄.
The last line is the most useful number in portfolio construction. With an average correlation of 0.3, no number of strategies can lift the combined Sharpe ratio by more than 1 ÷ √0.3, about 1.83 times. Adding systems helps only as long as they are genuinely different.
A worked example
Assets. The default table holds 36 monthly returns for four fictional funds: US stocks, international stocks, bonds and gold. Their average pairwise correlation is 0.29. The two stock funds are the most alike (0.78), while the least correlated pair is Intl stocks / Bonds at 0.10.
An equal-weight mix of the four would have had a volatility of 7.87%, against an average of 11.31% for each fund alone: a diversification ratio of 1.44.
The chart follows US stocks against bonds. Over the full three years their correlation is only 0.23, but that average hides two regimes: the rolling 12-month figure fell as low as -0.58 and ended at 0.80.
Trading strategies. The second tab holds 36 months of four fictional systems. Their average correlation is 0.12. Trend and Breakout correlate at 0.75, so they are largely the same bet, while Trend and Mean reversion correlate at -0.23. An equal-weight mix ran at 5.42% volatility against 9.09% for the average system, and its Sharpe ratio of 1.52 beats the average stand-alone figure of 0.95. The formula above predicts a multiplier of 1.72× from the average correlation alone; the actual gain is a little smaller because the four systems’ volatilities and Sharpe ratios differ.
Reading the colors
The matrix uses colors from the point of view of diversification. Red marks pairs at 0.50 or above: they tend to rise and fall together, so holding both adds less protection than the number of positions suggests. Green marks negative correlations, where one tends to gain when the other loses. These pairs are the most valuable in a portfolio, which is why they are shown as good even though a negative number usually looks like bad news.
Two checks help after the colors. First, the column of average correlations in the second table: the asset or strategy with the lowest value adds the most diversification to the rest. Second, the size of the sample. With 36 rows, a pair with no true relationship can easily show a correlation anywhere between about −0.33 and +0.33 by chance (roughly ±2 ÷ √n), so small differences between cells mean little.
Correlation regimes
Correlations are not constants. They move with the forces that drive returns, and they can change sign. For much of the two decades before 2022, US stocks and Treasury bonds were negatively correlated: bad news for growth lifted bonds as stocks fell. In 2022, with inflation and rising rates hurting both, they fell together. The example data mimics such a shift, and the rolling chart makes it visible.
| US stocks vs bonds | Correlation |
|---|---|
| Full 36 months | 0.23 |
| Lowest rolling 12-month value | -0.58 |
| Latest rolling 12-month value | 0.80 |
| Rolling 24-month range | -0.14 to 0.40 |
The dashed line in the chart, the average of all pairs, is a quick gauge of the regime for the whole portfolio. When it climbs, diversification is weakening across the board. A longer window smooths the line but reacts later to a change; a shorter one reacts sooner but is noisier.
Why strategy correlation matters when combining systems
A trader running several systems usually judges each one by its own backtest. The combination, though, depends at least as much on how the systems relate to each other.
- Similar rules make similar returns. Trend following and breakout systems often enter on the same moves, so their returns correlate strongly, as in the example. Running both doubles the bet rather than spreading it.
- Low correlation is worth more than a slightly higher Sharpe ratio. A system with a modest Sharpe ratio that is uncorrelated with the others can improve the portfolio more than a stronger system that duplicates what you already hold.
- Correlation in losses matters most. Two systems with low average correlation can still lose together in a crisis. Check the rolling chart around your worst months, and compare drawdowns with the max drawdown calculator.
- Backtests flatter diversification. Systems tuned on the same history can look less correlated in-sample than they turn out to be live. Out-of-sample or live returns give a more honest matrix.
- Weighting. Equal capital weights let the most volatile system dominate. To size the systems by risk instead, feed the volatilities and this matrix into the risk parity calculator or the portfolio volatility calculator.
What this calculator does not include
- Prices. The table must contain returns. Correlating price levels produces spurious high values for anything that trends. For two price series, the correlation calculator converts prices to returns first.
- Non-linear or tail dependence. Pearson correlation measures straight-line co-movement on average. It can miss assets that are independent most of the time but crash together.
- Asynchronous data. Markets that close at different times, or illiquid assets with stale prices, show artificially low correlations, especially with daily data. Weekly or monthly returns reduce the problem.
- Statistical significance per cell. The page does not test each correlation. Treat small differences in short samples as noise.
- Costs, capacity and leverage. The equal-weight mix and its Sharpe ratio ignore trading costs, financing and the risk-free rate.