The Sharpe ratio from first principles
On this page
Algorithmic trading is fascinating. You figure out some rules to buy or sell stocks and backtest them on a few years of past price data. Do this a few times and you have several strategies. How do you rank these strategies objectively? The first idea might be to rank them by the profit they make. A strategy that gives you higher profits is definitely better, right? It is easy to say this when you are just looking at the backtest. But past returns are no guarantee of future returns. When a strategy you are running is losing money, you cannot know that it will recover.
Suppose one strategy doubled your money but was down 50% along the way, while another slowly inched upwards, always positive, but giving a total return of only 10%. If you started running both of them today, you would stop the first strategy long before it lost 50% of your money. So looking at total returns is not the best idea. We look at risk-adjusted returns, and the most common measure of that is the Sharpe ratio. Let’s build it up from scratch.
Start with what a strategy actually is. Stripped of all the machinery, it is a time series of the returns it produces each day. Some are positive, some are negative. This series will have an average and some amount of scatter around that average. Traders call these the mean return (usually written μ) and the volatility (σ). Volatility is the standard deviation of the returns, which you can think of as the size of a typical swing away from the average. We will come back to how it is calculated, and why, in the Combining strategies section. Volatility matters a great deal, because it decides whether you can actually live through the strategy long enough to collect the average. But volatility is also important because it determines how much leverage you can take.
Leverage
What is leverage? A strategy’s return is a rate. If it makes 10% on $1,000, it makes 10% on $2,000 too, at retail trader size. The strategy doesn’t care where the money comes from. So if you have $1,000, borrow another $1,000 and run the same thing on $2,000, you’ve doubled your exposure. Every gain is twice as big, but so is every loss.
Leverage is available to almost everyone in some form. Equity brokers will lend you money against your portfolio (margin). Futures let you control a large position by posting a small deposit, often a few percent of its value. The details vary a lot, but in every case you can choose to run a strategy at half size, full size or several times size.
When you borrow, you pay interest. Say the strategy makes 5% and you borrow at 4%. At double size, you make 5% twice and pay 4% once, on the half you borrowed. That is 10% − 4% = 6%.
Here is another way to see the same 6%. You get the 4% that cash pays, plus twice the 1% that the strategy makes over cash. That 1% gap between a strategy’s return and what cash pays is called the excess return, and it is the only part that leverage multiplies.
In general, if the strategy returns μ, you borrow at rate r, and you run it at leverage f (f = 2 means double size), your return on your own money is:
r + f × (μ − r)
Volatility scales the same way. Say you have $1,000, borrow another $1,000, and the strategy drops 10%. You have lost $200, but you still owe the full $1,000 you borrowed. So the whole loss comes out of your own money, which is now down 20%. Every swing is multiplied by your leverage:
volatility at leverage f = f × σ
Leverage gives you a dial, with which you can turn the volatility of a strategy up or down. Turning the dial up means borrowing, as above. Turning it down is even simpler. You put only part of your money into the strategy and leave the rest in cash. If you run it with half your money, you get half the swings (plus interest on the half sitting in cash).
The Sharpe ratio
Suppose cash pays 0%, to keep the arithmetic clean. Strategy A makes 5% with 5% volatility. Strategy B makes 10% with 20% volatility.
Now run A at four times size. It makes 20% with 20% volatility. That’s the same volatility as B, and double the return.
So which one was better? A was, clearly. B’s higher headline return came entirely from running at a higher level of risk.
A fair measure of a strategy must not change when you scale it up or down. If it does, it’s measuring your sizing decision, not the strategy. Under leverage, excess return scales by f and volatility scales by f. Their ratio doesn’t move:
(f × (μ − r)) / (f × σ) = (μ − r) / σ
That ratio is the Sharpe ratio, named after William Sharpe, who proposed it in 1966 (by convention, the return and the volatility are both yearly numbers):
S = (μ − r) / σ
But that scale-invariance alone isn’t the property that makes the Sharpe ratio useful. Anything of the form “excess return divided by something that also scales with leverage” survives. You could divide by the worst drawdown instead, the most the strategy has ever been down from its high (that’s called the Calmar ratio). You could divide by only the downside volatility, ignoring the good days (the Sortino ratio).
There are other good properties that make the Sharpe ratio the most widely used metric rather than just one option among several. We will look at two of them.
Volatility drag
We’ve established that you can use leverage to increase returns if your strategy earns more than the borrowing rate. But you cannot do it arbitrarily. Volatility imposes a limit.
Suppose you gain 50% and then lose 50%. The average of +50% and −50% is zero, so it feels like you should be back where you started. But that’s not true. $100 becomes $150, then $75. The loss was applied to a bigger amount than the gain was.
If a strategy with volatility σ gains σ one year and loses σ the next year, it leaves you with:
(1 + σ) × (1 − σ) = 1 − σ²
Volatility costs you σ² every two years, or about σ²/2 a year, even when the average return is zero. With 20% swings that’s roughly 2% a year. This cost is usually called volatility drag, and it’s why the rate at which your money actually grows is a little below its average return:
growth per year ≈ average return − σ²/2
This is an approximation. It is accurate when each individual swing is small, which is the case when returns arrive in many small steps, like daily returns.
Now suppose you run the strategy at some leverage, so that its volatility becomes v (that is, f × σ, the strategy’s own volatility times your leverage). For a strategy with Sharpe ratio S, the excess return is then S × v. But the drag is v²/2. Over and above cash, that gives:
growth ≈ S × v − v²/2
The first term grows linearly with the volatility. The second grows with its square. At low volatility the square is tiny and more risk helps. But a square always catches up in the end, and after that more risk makes things worse.
Here’s a strategy with a Sharpe ratio of 0.5, which is respectable:
| Volatility you run | Return from the edge (S × v) | Drag (v²/2) | Growth |
|---|---|---|---|
| 10% | 5.0% | 0.5% | 4.5% |
| 25% | 12.5% | 3.1% | 9.4% |
| 50% | 25.0% | 12.5% | 12.5% |
| 75% | 37.5% | 28.1% | 9.4% |
| 100% | 50.0% | 50.0% | 0.0% |
At 100% volatility the expected return is 50%, the strategy has a genuine edge, and your money doesn’t grow at all. The drag has eaten everything.
The Kelly criterion
We can derive the limits from the formula. Write it as v × (S − v/2). It’s zero when v = 0, and zero again when v = 2S. In between it rises and falls symmetrically, so the peak is halfway, at v = S.
Your money grows fastest when you run a strategy at a volatility equal to its Sharpe ratio. This is known as the Kelly criterion (after John Kelly, who worked out the betting version in 1956). Put v = S back into the formula and the best growth you can get is S²/2. A strategy with double the Sharpe ratio can grow your money four times as fast.
This is a ceiling, not a recommendation. For the strategy in the table it means running at 50% volatility, which very few people could sit through. In practice people run at half the Kelly volatility or less. At half, you still get three quarters of the growth.
At any volatility, every strategy pays the same drag, v²/2. So at a given risk level, the strategy with the higher Sharpe ratio grows your money faster.
Combining strategies
When we move from one strategy to multiple, it becomes important to measure how good the combination is. Adding up the average returns is easy, because the average of a sum is the sum of the averages. The volatility is harder, because swings in opposite directions can cancel. If one strategy is having a bad year while the other has a good one, the combination barely moves.
To calculate a standard deviation, take each return’s distance from the mean, square it, average the squares and take the square root. The average of the squares, before taking the root, is called the variance.
Using the root of the average of squares is a choice, not a law of nature. You could measure swings by their average size ignoring sign (the mean absolute deviation), or by how bad the worst few percent of outcomes are. Standard deviation won out mainly because it has convenient mathematical properties. For example, the variances of independent things add up, which is what we use below. Squares also match how swings cost you money, since a swing twice as big does four times the damage to compounding.
Take any two strategies, A and B. In any given year, each one’s return is its own average plus a deviation, which is how far above or below average it landed that year. Call those deviations d_A and d_B. Hold both strategies and your combined return is the sum of the two averages plus the sum of the two deviations.
To get the variance of the combination, square that combined deviation and average it over many years. Squaring is just algebra:
(d_A + d_B)² = d_A² + d_B² + 2 × d_A × d_B
Now average each term over many years:
- The average of d_A² is, by definition, A’s variance. Likewise for B.
- The average of d_A × d_B is a new quantity called the covariance. It’s positive if the two strategies tend to have good years and bad years at the same time (both deviations have the same sign, so the product is positive). It’s negative if one tends to do well when the other does badly. It’s zero if there’s no consistent pattern either way.
This gives:
variance of A + B = variance of A + variance of B + 2 × covariance
The covariance mixes together two things: how much the strategies move together, and how big their swings are. We can separate them. Divide the covariance by the two volatilities and you get the correlation, written ρ, a pure number between −1 and +1.
In other words, covariance = ρ × σ_A × σ_B. Take the simplest case, with cash paying 0% again, two strategies with the same average return μ and the same volatility σ, held in equal amounts. The combined average is 2μ, and:
variance of the pair = σ² + σ² + 2ρσ² = 2σ²(1 + ρ)
Three cases show what this means for the Sharpe ratio:
- Unrelated (ρ = 0): the variance is 2σ², so the volatility is σ√2. The combined Sharpe ratio is 2μ / (σ√2), which is √2 × S, about 41% better than either strategy alone.
- Identical (ρ = 1): the variance is 4σ², so the volatility is 2σ, and the Sharpe ratio is 2μ / 2σ = S. No improvement at all. You bought the same edge twice.
- Opposite (ρ = −1): the variance is zero. The swings cancel completely. This is a perfect hedge, and it’s very rare to find one that still makes money.
Most pairs of real strategies sit somewhere between 0 and 1, and the lower the better.
Many strategies
With N strategies the logic is the same, just with more terms. The combined average is Nμ. The variance has N “own” terms, each σ², and a 2ρσ² term for every pair of different strategies, of which there are N × (N − 1) / 2. Dividing the average by the square root of the variance gives:
combined Sharpe ratio = S × √N / √(1 + (N − 1)ρ)
This formula assumes every strategy has the same Sharpe ratio, the same volatility and the same correlation with every other, and that you hold them in equal amounts. Real portfolios aren’t that tidy, but the general rule that lower correlation increases the Sharpe ratio still applies. That rule is the starting point of modern portfolio theory (Harry Markowitz, 1952).
Here it is with strategies that each have a Sharpe ratio of 1 and a correlation of 0.1:
| Number of strategies | Combined Sharpe ratio |
|---|---|
| 1 | 1.00 |
| 2 | 1.35 |
| 6 | 2.00 |
| 30 | 2.77 |
| 300 | 3.12 |
Going from one strategy to six doubles the Sharpe ratio. Going from six to three hundred adds only about half as much again. As N grows, the formula levels off at a ceiling of S / √ρ (about 3.16 here), which depends on the correlation and not on the count.
You can’t do this with the Calmar or Sortino ratios. Drawdowns and downside volatility don’t add up in any simple way when you combine strategies.
Correlations are estimated from past returns, and they aren’t stable. They tend to rise sharply in a crisis, when many strategies get hit by the same selling at once, which is exactly when you need the diversification most. So correlation measured in calm times is a best case, not a guarantee.
Where it breaks
We’ve been making the case for the Sharpe ratio, so it’s only fair to say where it goes wrong.
Everything above assumed that volatility is a good summary of risk. That’s reasonable when a strategy’s good days and bad days are roughly mirror images of each other. It fails badly when they aren’t.
Picture a strategy that makes a small, steady profit almost every day and very occasionally loses a huge amount. Most of the time such a strategy barely moves, so its measured volatility is tiny and its Sharpe ratio looks good, until the day the huge loss arrives. If that day is not in your backtest, the Sharpe ratio knows nothing about it.
Two strategies with the same Sharpe ratio will give you the same returns only when you run them at the same volatility. But there are practical limitations to this. What limits your leverage is the worst day, not the average one. If a strategy’s worst day at a particular volatility is a 10% loss, then running it at ten times leverage wipes you out on that day. So not all strategies with the same Sharpe ratio can give you the same returns. Ranking strategies purely by Sharpe ratio unfairly favours the ones that can’t actually be levered up.
The opposite also happens. Trend-following strategies tend to lose a little most of the time and occasionally make a lot. Their big winning months count as “volatility” and get penalised just like losses would, so their Sharpe ratio understates them.
Conclusion
So when you look at a strategy, ask three things. How much did it make over cash for the volatility it took? That is its Sharpe ratio. How bad was its worst day? That tells you how far you can actually turn the dial. How does it move with what you already run? That tells you what it adds. Just comparing headline return is not enough.
References
- William F. Sharpe, Mutual Fund Performance, The Journal of Business, 1966.
- J. L. Kelly Jr., A New Interpretation of Information Rate, Bell System Technical Journal, 1956.
- Harry Markowitz, Portfolio Selection, The Journal of Finance, 1952.