Sub topic 3
Measuring declines: drawdown and the math of recovery
This chapter assumes you know what a stock and a stock market index are, and that you are comfortable with percentages. The Python examples are optional but run as shown. Later chapters use the numbers defined here to define corrections and bear markets, so it is worth getting the arithmetic exact.
Why a decline needs a precise measure
People often say "the market is down 15%." That sentence is incomplete. Down from where? Over what period? A fall from yesterday's close is a different thing from a fall from the highest level reached last year.
Investors use one measure to answer these questions: drawdown. A drawdown is the percentage decline from a previous peak to a later low point. The previous peak is the highest value reached so far. The low point is called the trough. The measure is usually computed on an index level or on the value of a portfolio.
The formula is:
drawdown = price / peak - 1Here peak is the highest price seen up to that moment. Because the price can never be above the running peak, the result is zero or negative. A drawdown of 0 means the price is at a new high. A drawdown of -0.20 means the price is 20% below its peak.
A worked example by hand
Take this series of index closes: 100, 110, 105, 88, 92, 120.
| Step | Price | Running peak | Drawdown |
|---|---|---|---|
| 1 | 100 | 100 | 0.0% |
| 2 | 110 | 110 | 0.0% |
| 3 | 105 | 110 | -4.5% |
| 4 | 88 | 110 | -20.0% |
| 5 | 92 | 110 | -16.4% |
| 6 | 120 | 120 | 0.0% |
Step 4 shows the key idea. The price at step 4 is 88, and the peak is 110, so the drawdown is 88 / 110 - 1 = -0.20. The decline is measured from 110, not from the 105 of the day before. At step 5 the price has risen, but the drawdown is still -16.4% because the peak has not been reached again.
The maximum drawdown is the worst value of the drawdown over the whole period. In this series it is -20.0%, reached at step 4. The final step shows a full recovery, because the price is above the old peak and the drawdown is back to zero.
Computing drawdown in code
The function below tracks the running peak and keeps the worst drawdown it has seen.
def max_drawdown(prices):
"""Return the largest peak-to-trough decline as a negative fraction."""
peak = prices[0]
worst = 0.0
for price in prices:
peak = max(peak, price)
worst = min(worst, price / peak - 1)
return worst
prices = [100, 110, 105, 88, 92, 120]
print(f"{max_drawdown(prices):.1%}") # -20.0%The loop makes a single pass over the data. It updates the peak first, then compares the current price with that peak. Updating the peak first matters: on a day with a new high, the drawdown is exactly zero and cannot be mistaken for a decline.
Drawdown versus other kinds of loss
Drawdown is easy to confuse with other measures. Keeping them apart avoids common errors.
- Return over a period. A one-year return compares the price today with the price exactly one year ago. A drawdown compares the price with the highest price in the past, whatever the date.
- Daily or weekly change. A single-day drop of 3% is a small move. A drawdown can build up from many small drops.
- Loss on your purchase. If you bought at 105, your own loss at 88 is 16.2%. The index drawdown is still 20% because it is measured from the peak. Your personal loss depends on when you bought, while the index drawdown does not.
- Volatility. Volatility describes how widely prices swing, up and down. Drawdown only looks at declines from a peak. A very volatile series can have a small maximum drawdown if it keeps making new highs.
Two other terms are useful. The drawdown duration is the time from the peak until the price first returns to that peak. The time from the trough back to the peak is sometimes called the recovery time. Both can be much longer than the fall itself.
Putting labels on a drawdown
Investors give names to declines of certain sizes. The most common rules of thumb are a drop of 10% or more for a correction and 20% or more for a bear market. Later chapters cover these in detail, and also where they break down. For now, the point is that these labels are conventions applied to a number. They are not laws of nature, and the drawdown is the number.
def label_decline(drawdown):
"""Classify a drawdown (negative fraction) using the common rules of thumb."""
if drawdown <= -0.20:
return "bear market territory"
if drawdown <= -0.10:
return "correction territory"
return "ordinary pullback"
for d in (-0.04, -0.12, -0.25):
print(f"{d:.0%}: {label_decline(d)}")The output is:
-4%: ordinary pullback
-12%: correction territory
-25%: bear market territoryThe function uses <= because both thresholds are written as "10% or more" and "20% or more". The words "territory" are deliberate. A drawdown of -12% today may become -22% next month, so the label describes the current state, not a final verdict.
The math of recovery
The most important consequence of drawdown arithmetic is that recovery is asymmetric. A percentage loss and the percentage gain needed to undo it are not the same number.
Here is the reason. A loss of 20% is taken from the peak value. The gain needed to recover is taken from the lower value, which is a smaller base. So the same dollar amount is a larger percentage of the smaller number.
Start with 100. After a 20% loss you have 80. To get back to 100 you need to gain 20, and 20 is 25% of 80. In general:
gain needed = 1 / (1 + drawdown) - 1Here drawdown is negative. For a drawdown of -0.20, this gives 1 / 0.8 - 1 = 0.25.
def gain_to_recover(drawdown):
"""Gain needed to return to the prior peak after a decline (drawdown is negative)."""
return 1 / (1 + drawdown) - 1
for d in (-0.10, -0.20, -0.50):
print(f"after {d:.0%} loss, need {gain_to_recover(d):.1%} gain")The output is:
after -10% loss, need 11.1% gain
after -20% loss, need 25.0% gain
after -50% loss, need 100.0% gainA longer table shows how quickly the requirement grows.
| Drawdown | Gain needed to recover |
|---|---|
| -5% | 5.3% |
| -10% | 11.1% |
| -20% | 25.0% |
| -30% | 42.9% |
| -40% | 66.7% |
| -50% | 100.0% |
| -70% | 233.3% |
| -90% | 900.0% |
The curve bends upward. Small declines are almost symmetric, but deep declines need very large gains. A 50% fall needs the price to double. This is one reason investors pay close attention to the depth of a decline and not only its frequency.
Edge cases and common errors
- Adding and subtracting percentages. A 20% fall followed by a 20% rise does not return you to the start. It gives 0.8 x 1.2 = 0.96, which is 4% below the peak. Percent changes multiply. They do not add.
- Measuring from the wrong peak. If you reset the peak after every bounce, you understate the decline. A drawdown must use the highest level since the start of the period you are studying, until a new high replaces it.
- Closing prices versus intraday prices. Many sources use daily closing values. Others use the lowest price traded during the day. The same event can show a deeper drawdown on intraday data, so check which one a figure uses before comparing two numbers.
- Price index versus total return. A price index ignores dividends. A total return index includes them. Dividends paid during a decline shorten the time to recover, so a total return drawdown is usually shallower and shorter than the price-only figure.
- Inflation. The drawdown above is nominal, meaning it is measured in current money. In real terms, which adjusts for inflation, a decline can be deeper and a recovery slower.
- Short data. The maximum drawdown depends on the period you look at. A series of two calm years will show a small maximum drawdown even though the asset may be risky. The worst drawdown in a sample is not an upper limit on future declines.
- Empty input. The function
max_drawdownas written fails on an empty list becauseprices[0]does not exist. Add a check if your data might be empty.
Averaging in during a decline
Recovery math also explains why some investors add money regularly through a fall. If you invest a fixed amount each period, you buy more shares when prices are low. This is called dollar-cost averaging, and a later chapter looks at it as a strategy. Here we only show the arithmetic, because it connects to the asymmetry above.
monthly_amount = 100
prices = [100, 80, 60, 90]
shares = sum(monthly_amount / p for p in prices)
invested = monthly_amount * len(prices)
average_cost = invested / shares
average_price = sum(prices) / len(prices)
print(f"average cost per share: {average_cost:.2f}")
print(f"average price: {average_price:.2f}")The output is an average cost of about 77.59 and an average price of 82.50. The average cost is lower because the 100 invested at a price of 60 bought many more shares than the 100 invested at 100. The average cost is a harmonic mean of the prices, and a harmonic mean is never larger than the simple average.
This does not guarantee a profit. If prices keep falling, the investor holds shares that are worth less than the amount paid. It shows only that the break-even point can be reached before the index returns to its old peak.
Summary
- Drawdown is price divided by the running peak, minus 1. It is zero or negative.
- Maximum drawdown is the worst drawdown in the period studied.
- Recovery needs a gain of 1 / (1 + drawdown) - 1, which grows faster than the loss.
- Names such as correction and bear market are labels attached to drawdown sizes.
- Always state the peak, the data (close or intraday, price or total return), and the period.
Exercise
An index peaks at 4,800, falls to 3,600, and later reaches 4,200. (a) What was the maximum drawdown? (b) What is the drawdown at 4,200? (c) What gain from 4,200 is needed to reach a new high?
Show answer
(a) 3,600 / 4,800 - 1 = -25.0%, so it is in bear market territory by the 20% rule of thumb. (b) 4,200 / 4,800 - 1 = -12.5%. (c) 4,800 / 4,200 - 1 = 14.3%. The maximum drawdown stays at -25.0% even after the partial recovery, because it records the worst point reached.
Exercise
A fund loses 40% in one year and then gains 40% the next year. Is the investor back to the starting value? If not, where is the value after two years, and what gain was needed in the second year?
Show answer
No. 0.6 x 1.4 = 0.84, so the value is 16% below the start. The gain needed after a 40% loss is 1 / 0.6 - 1 = 66.7%, not 40%.
Exercise
Modify max_drawdown so it also returns the index position of the trough, and make it handle an empty list. Use the series [100, 110, 105, 88, 92, 120] to check your answer.
Show answer
One solution is the code below. It returns (0.0, None) for empty input and (-0.2, 3) for the series, since 88 is at index 3. def maxdrawdownwithtrough(prices): if not prices: return 0.0, None peak = prices[0] worst = 0.0 troughindex = None for i, price in enumerate(prices): peak = max(peak, price) dd = price / peak - 1 if dd < worst: worst = dd troughindex = i return worst, troughindex