Sub topic 3
Measuring Declines: Drawdown and the Math of Recovery
This chapter assumes you understand stocks, market indexes, percentages, and basic Python. You will use a price series to measure how far an investment falls from a previous high and how much growth it needs to recover.
From price trend to drawdown
A drawdown is the percentage decline from a previous peak to a later price. The peak is the highest price reached so far, and the trough is the lowest price after that peak before a new high is reached.
The formula is:
\text{drawdown}=\frac{\text{trough}-\text{peak}}{\text{peak}}A drawdown is usually written as a negative percentage. If an index rises to 100, falls to 80, and later rises again, its drawdown is:
\frac{80-100}{100}=-20\%The maximum drawdown is the largest peak-to-trough fall during the period being studied. It measures historical downside, not the amount an investment will necessarily lose in the future.
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 series reaches a peak of 110, then falls to 88. The decline is 22 points, or 20% of 110. The later price of 120 creates a new high, so the drawdown ends.
Why losses and recoveries are asymmetric
A loss and the gain needed to reverse it are calculated from different bases. After a 20% loss, 100 becomes 80. Returning from 80 to 100 requires a 25% gain, not a 20% gain.
The recovery formula for a negative drawdown \(d\) is:
\text{required gain}=\frac{1}{1+d}-1| Loss from peak | Value from 100 | Gain needed to recover |
|---|---|---|
| 10% | 90 | 11.1% |
| 20% | 80 | 25.0% |
| 50% | 50 | 100.0% |
def gain_to_recover(drawdown):
"""Return the gain needed to recover from a negative drawdown."""
return 1 / (1 + drawdown) - 1
for drawdown in (-0.10, -0.20, -0.50):
gain = gain_to_recover(drawdown)
print(f"after {drawdown:.0%} loss, need {gain:.1%} gain")This asymmetry explains why avoiding very large losses matters. A portfolio that falls 50% must double before it returns to its starting value. Compounding works in both directions.
Reading a drawdown chart
A drawdown chart sets the current peak as the reference point and shows the percentage distance below it. It differs from a price chart: a market can be rising overall while still experiencing a temporary drawdown.
Interpreting the number
The number alone does not describe the full experience. Two drawdowns can have the same depth but very different durations. One may last several weeks; another may take years to recover. Consider:
- Depth: the largest percentage decline.
- Duration: how long the investment remains below its previous peak.
- Recovery time: how long it takes to reach a new high.
- Frequency: how often declines occur in the chosen period.
Drawdown is therefore a measurement tool, not a complete explanation of market conditions or a prediction of what happens next.
Exercise
An index falls from 250 to 200 and later rises to 240. What was the drawdown, and what percentage gain from 200 would restore the old peak?
Show answer
The drawdown was (200 - 250) / 250 = -20%. The required gain was 250 / 200 - 1 = 25%.