Maximum drawdown
Maximum drawdown is the biggest fall from a peak to a later low, as a share of the peak. It is the worst loss you would have suffered if you had invested at the worst possible moment.
01The formula
- the account value at time t
- the running peak: the highest value reached up to time t
- the drawdown at time t: how far below its best level the account is
- the largest drawdown over the whole history
02See it move
03Where it is used
- Risk managerSets drawdown limits: if a desk or strategy falls a set percentage from its peak, it must cut risk or stop trading.
- Portfolio managerShows the maximum drawdown next to returns, because investors judge a fund by how painful its worst stretch was.
- Retail traderChecks the drawdown of a backtest to see whether they could really sit through its worst losing run.
04Why traders use it
Volatility describes typical days; drawdown describes the stretch that makes people quit. Many good strategies are abandoned in their worst drawdown, so you need to know how deep it can get before you start.
05Worked example
In the simulated sample with drift 10% and volatility 25% over 3 years, the account peaked at $142.98 and then fell to $78.30: a maximum drawdown of 45.2%. Over the whole run it returned −1.4%.
06How it is built
- Walk through the equity curve and keep the running peak .
- At each time compute the drawdown , which is zero at a new high.
- The maximum drawdown is the largest of those numbers.
- Remember the recovery: after a fall of you need a gain of to get back to the peak.
07The common mistake
Treating a backtest's maximum drawdown as the worst case. It is one sample of a random quantity, and the longer you trade, the deeper the worst drawdown tends to get. Press New sample on the model to see how much it varies.
08In Python and LaTeX
import numpy as np
rng = np.random.default_rng(7)
mu, sigma, years = 0.10, 0.25, 3
dt, n = 1/52, 52*years
r = (mu - sigma**2/2)*dt + sigma*np.sqrt(dt)*rng.standard_normal(n)
equity = 100*np.exp(np.concatenate([[0], np.cumsum(r)]))
peak = np.maximum.accumulate(equity)
print('max drawdown:', ((peak - equity)/peak).max()) # a different sample from the page's\text{MDD} = \max_{t}\; \frac{P_t - V_t}{P_t}, \qquad P_t = \max_{s \le t} V_s09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.