The Claude Quant PlaybookDownload ebookDownload ebook

Maximum drawdown

beginnerRisk and portfolio3 of 13

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.

Build a trading system with Claude.Download ebook

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

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

  1. Walk through the equity curve and keep the running peak .
  2. At each time compute the drawdown , which is zero at a new high.
  3. The maximum drawdown is the largest of those numbers.
  4. 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_s

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.