After the posts on volatility, the next thing anyone building a portfolio or a trading book has to understand is correlation, which is how two assets move in relation to each other. Volatility tells you how much one thing moves. Correlation tells you whether two things move together, and it is the quantity that decides whether holding both of them is diversification or just the same bet twice.

The number
Correlation is measured on a scale from -1 to +1. At +1 two assets move in the same direction by the same proportion every time. At -1 they move in opposite directions by the same proportion. At 0 there is no linear relationship between their movements at all. Real pairs of assets sit somewhere in between, and the useful question is not whether the correlation is positive or negative but how far from zero it is, and how stable it has been.
The standard way to calculate it is the Pearson correlation coefficient:
\[r = \frac{\sum (X – \bar{X})(Y – \bar{Y})}{\sqrt{\sum (X – \bar{X})^2}\,\sqrt{\sum (Y – \bar{Y})^2}}\]where X and Y are the returns of the two assets over the same dates and X̄ and Ȳ are their average returns. The numerator is large and positive when the two tend to be above or below their averages on the same days, large and negative when one is above while the other is below, and near zero when there is no pattern. The denominator scales the result so that it always lands between -1 and 1. I work through the calculation on real data in the Python post that follows this one, and most platforms will give you a correlation matrix without any calculation at all.
One thing to be careful of: calculate it on returns, not on prices. Two assets that both went up over a year will show a very high correlation of prices even if their day-to-day moves had nothing to do with each other. Returns strip out the shared trend and tell you whether the two things actually respond to the same days in the same way.
Where correlations show up
Across asset classes, the relationships that get talked about most are equities against government bonds, gold against the dollar, and commodities against the currencies of the countries that export them. Equities and bonds have often moved in opposite directions, with money going into bonds when stocks fall, though that relationship has broken down for long stretches when inflation was the main worry and both fell together. Gold tends to rise when the dollar weakens, partly because it is priced in dollars. The Canadian dollar tends to follow oil, because oil is such a large part of what Canada sells abroad.
Within a single market, stocks in the same sector move together because they respond to the same news. Two large technology companies will usually show a high correlation, and the constituents of an index are positively correlated with each other almost by definition, which is why a portfolio of twenty large-cap stocks is far less diversified than it looks.
In currencies, pairs that share a leg are correlated through that leg. EUR/USD and GBP/USD both have the dollar on one side, so when the dollar moves they move together. The yen and gold both tend to strengthen when markets are frightened, which means USD/JPY tends to fall when gold rises, a negative correlation that people sometimes get the wrong way round.
In crypto, Bitcoin and Ethereum are highly correlated with each other, usually somewhere above 0.7 on daily returns, and I look at exactly how much in a separate post. Bitcoin’s correlation with traditional markets is less stable. For long periods it has traded like a high-beta technology stock; at other times it has gone its own way entirely.
What it is for
Diversification is the obvious use. A portfolio reduces risk only to the extent that its holdings are imperfectly correlated. If everything in it moves together, a bad day is bad everywhere at once and the diversification was cosmetic. So the first thing I do with any set of positions is look at the correlation between them, and the thing I am looking for is anything above about 0.8, because those positions are effectively one position and should be sized as one.
Hedging is the same idea in reverse. If you are long something and want protection, you short something that is highly correlated with it. The hedge is only as good as the correlation, and if the correlation drops the hedge stops working at exactly the moment you need it.
And there is a style of trading built entirely on correlation breaking down. If two assets have moved together for years and suddenly diverge, either something real has changed or one of them is mispriced, and finding out which is a trade. I write about that under relative value trading.
What I use to look at it
For a quick view, TradingView has correlation indicators and lets you script your own. For anything serious I use pandas in Python, or Excel when I want someone else to be able to follow the working. A Bloomberg terminal does all of this and more, if you have one. Portfolio Visualizer is a reasonable free tool for looking at how a set of holdings would have behaved together over time.
What it does not tell you
Correlation is not causation. Two assets moving together does not mean one drives the other; often both are responding to a third thing.
It is not constant. A correlation calculated over the last year is a description of the last year. It will drift, and sometimes it will break, and the only way to know is to keep measuring it on a rolling window rather than quoting a single figure.
It depends on the horizon. Two assets can be tightly correlated day to day and loosely correlated month to month, or the other way round, and you need to measure it at the horizon you actually trade.
And it rises in a crisis. This is the one that hurts. In a serious sell-off, assets that normally have little to do with each other start falling together, because people sell whatever they can rather than whatever they should. Correlations measured in calm markets overstate the diversification you will have when you need it, and any risk model that does not allow for that is going to be wrong on the day it matters.