18 — Backtest & Validate

Maximum Drawdown & Recovery#

Risk✓ Mathematical
◆ The PatternMeasuring worst-case loss from peak — depth, duration, and recovery time

Maximum drawdown is the largest peak-to-trough decline in portfolio value. It answers the question every investor asks: "How bad can it get?" Recovery time — how long to reach a new high — is equally important.

DD(t) = (Peak(t) − Value(t)) / Peak(t)
Drawdown at time t. Max Drawdown = max over all t. Expressed as percentage.
// Interactive equity curve with drawdown shading
Volatility20%
Max DD
# Python — drawdown analysis
import numpy as np

cum_returns = (1 + returns).cumprod()
running_max = cum_returns.cummax()
drawdown = (cum_returns - running_max) / running_max
max_dd = drawdown.min()
print(f"Max Drawdown: {max_dd:.1%}")

# Recovery time
underwater = drawdown < 0
recovery_periods = underwater.astype(int).groupby(
    (~underwater).cumsum()
).sum()
Psychology: A 50% drawdown requires a 100% gain to recover. A 33% drawdown needs 50%. The math is against you — managing drawdown is as important as maximising return.
← Previous
Sharpe Ratio & Risk-Adjusted Returns
Open in the full reader, with the topic sidebar →