Skip to content

Quant Lab · Level II: Risk and Reward · Module 10

Drawdowns

The loss that hurts is measured from the peak, and recovering costs more than the fall.

Runs in your browser · Python, numpy, pandasReal data · NSE index closesUpdated 2026-12-06

The idea

A drawdown is how far an investment has fallen from its highest earlier value. If your portfolio peaked at 100 and sits at 70, you are in a 30 percent drawdown. The maximum drawdown is the deepest such fall over a period, measured from a peak to the following trough.

Drawdowns matter because losses and gains do not cancel evenly. The program prints that a 50 percent fall needs a 100 percent gain to get back to even. Recovery time, the days until the old peak is reached again, is often what tests an investor's patience.

Volatility alone does not tell you how bad the worst stretch felt. Drawdown does, which is why it is a core risk measure alongside volatility.

  • Drawdown = current value divided by the running peak, minus 1; it is zero at a new high and negative otherwise.
  • Maximum drawdown is the worst peak-to-trough fall in the period.
  • Recovery gain = fall / (1 - fall): a 50 percent fall needs a 100 percent gain.
  • Recovery time is the gap from the trough until the old peak is regained, and it may never happen within the data.
  • Share of days underwater shows how often you sit below a previous high.
  • Drawdowns depend on the window; a longer history usually contains a deeper one.

The maths

DDt=Ptmaxs≤t⁡Ps−1

Drawdown on day t is the price divided by the highest price seen so far, minus one.

MDD=mint⁡DDt

The maximum drawdown is the most negative drawdown value in the whole series.

g=f1−f

After falling a fraction f, you need a gain g on the reduced amount to get back to the old peak.

The code

Every number on this page comes from this program. Press Run to execute it in your browser. You can edit the code and run it again.

SIMULATED · lab_10.py
import numpy as np, pandas as pd
rng = np.random.default_rng(7)
# gain needed to recover from a fall
for f in [0.1, 0.2, 0.3, 0.5, 0.7]:
    g = f / (1 - f)
    print('fall', int(f*100), '-> gain', round(g*100))
# simulated 10 years of daily returns
r = rng.normal(0.0005, 0.01, 2520)
px = pd.Series(100 * np.cumprod(1 + r))
peak = px.cummax()  # running high
dd = px / peak - 1  # drawdown series
print('max drawdown %:', round(dd.min()*100, 1))
trough = dd.idxmin()
top = px.loc[:trough].idxmax()
print('peak day', top, 'trough day', trough)
after = px.loc[trough:]
back = after[after >= px[top]]
if len(back):
    n = int(back.index[0] - trough)
    print('recovery took days:', n)
else:
    print('not recovered by day 2520')
print('share of days underwater %:',
      round((dd < 0).mean() * 100, 1))
fall 10 -> gain 11
fall 20 -> gain 25
fall 30 -> gain 43
fall 50 -> gain 100
fall 70 -> gain 233
max drawdown %: -45.6
peak day 1 trough day 616
recovery took days: 917
share of days underwater %: 97.9

The first loop applies g = f/(1-f) to falls of 10, 20, 30, 50 and 70 percent and prints the gain needed; a 50 percent fall prints 100.

Next we simulate 2,520 daily returns (about 10 years of trading days) with a fixed seed. np.cumprod turns them into a price path starting near 100. cummax gives the running high, and price divided by it, minus 1, is the drawdown series.

The minimum of that series is the printed maximum drawdown. idxmin gives the trough day, and the highest price up to the trough gives the peak day. Then we scan after the trough for the first day the price is back at or above the peak; the gap is the printed recovery time, or a message saying it did not recover. The final line prints the share of days with drawdown below zero.

0.00%61.8%124%185%247% 11.1% 10% fall 25.0% 20% fall 42.9% 30% fall 100% 50% fall 233% 70% fall
Gain needed to recover grows faster than the fall itself: a 50 percent fall needs a 100 percent gain.

On real NSE data

The same idea, applied to daily closing values of NSE indices. The program loads nse_indices.csv, our free export of index closes since 2013.

REAL NSE DATA · nse_data.py
df = pd.read_csv('nse_indices.csv',
    parse_dates=['date'], index_col='date')
s = df['nifty_50'].dropna()
d = s / s.cummax() - 1
t = d.idxmin(); p = s.loc[:t].idxmax()
print('Nifty max drawdown %:', round(d.min()*100, 1))
print('peak', p.date(), 'trough', t.date())
b = s.loc[t:]; b = b[b >= s[p]]
if len(b):
    r = b.index[0]
    print('back on', r.date(), (r-t).days, 'days')
else:
    print('not yet recovered')
u = d < -0.10; e = u & ~u.shift(fill_value=False)
print('falls beyond 10%:', int(e.sum()))
print('days underwater %:', round((d<0).mean()*100, 1))
Nifty max drawdown %: -38.4
peak 2020-01-14 trough 2020-03-23
back on 2020-11-09 231 days
falls beyond 10%: 41
days underwater %: 90.4

Runs after the code above, so it can use the variables and functions defined there.

WHAT THE DATA SHOWED

The real_code applies the same steps to the Nifty 50 closing values from the file. It prints the maximum drawdown in percent, the peak and trough dates, and, if the old peak was regained, the recovery date and the number of calendar days from trough to recovery. It also prints how many separate falls went beyond 10 percent and the share of days the index sat below an earlier high. Read those printed values for the exact figures. This is past data describing what happened, not a forecast of what will happen.

-47.6%-35.1%-22.5%-9.89%2.70% 0.006301,2601,8692,499
Simulated drawdown series: zero at new highs, negative in between.
-31.7%-23.4%-15.0%-6.59%1.80% 2013-012016-072020-012023-052026-11
Nifty 50 drawdown from its running high, sampled every 10th trading day.

Past data, not a forecast. Indices are price indices without dividends.

In practice

Fund factsheets, PMS reports and risk reviews in India routinely quote maximum drawdown, and investors compare it with their own tolerance when planning SIPs or asset allocation. Calmar-style ratios divide return by maximum drawdown. Limitations: it is one worst path, so it is sensitive to the start and end of the window; it ignores how long you stayed down unless recovery time is added; and the future may bring a deeper fall than any seen in the past.

Common mistakes

  • Averaging a gain and a loss: a 50 percent fall followed by a 50 percent gain does not return you to even.
  • Measuring the fall from the starting value instead of the running peak.
  • Treating the maximum drawdown as a worst-case limit rather than the worst case seen so far.
  • Comparing drawdowns across different time windows as if they were equal.
  • Using calendar days and trading days interchangeably when stating recovery time.

Exercises

Try each one in the code cell above before opening the answer.

1. A stock falls 20 percent. What gain restores the old peak?

g = 0.2 / (1 - 0.2) = 0.25, so 25 percent. Check: 100 falls to 80, and 80 x 1.25 = 100.

2. Prices are 100, 120, 90, 110, 130. What is the maximum drawdown?

Running peaks are 100, 120, 120, 120, 130. Drawdowns are 0, 0, -25%, -8.3%, 0. The maximum drawdown is -25 percent.

3. How would you change the code to find the second-deepest separate drawdown?

Label each episode (a new peak starts a new one), take the minimum drawdown of each episode, then sort those minima and pick the second most negative.

Interview questions

The kind of question asked in quant, risk and trading interviews, with a model answer.

Why does a 50 percent loss need a 100 percent gain?

The gain applies to a smaller base. 100 becomes 50, and doubling 50 is needed to return to 100. In general g = f/(1-f).

How is maximum drawdown different from volatility?

Volatility measures the typical size of daily moves in both directions. Maximum drawdown measures the worst cumulative peak-to-trough loss, so it captures the path and duration of losses.

What are the limitations of maximum drawdown?

It depends on the sample window, reflects a single worst episode, ignores recovery time unless added, and cannot bound future losses.

Mini project

BUILD IT YOURSELF

Drawdown report card

Extend the program into a reusable function that reports drawdown statistics for any Nifty index column.

  1. Write a function taking a price series and returning maximum drawdown, peak date, trough date and recovery date.
  2. Run it on nifty_50, nifty_bank and nifty_it using dropna on each column.
  3. Add the number of separate episodes beyond 10 percent for each index.
  4. Compute the share of days underwater for each.
  5. Put the results in a pandas DataFrame and sort by maximum drawdown.
  6. Write three sentences describing the past differences, without predicting the future.
Sign in free to get the notebook A Jupyter notebook with this module's code, the NSE data loader and one empty cell per step. Free account, no card.

FAQ

Is drawdown the same as loss?

No. A drawdown is measured from the highest previous value, not from the price you bought at. It can be larger or smaller than your own loss.

Can the drawdown be positive?

No. It is zero at a new high and negative otherwise, because the running peak is never below the current price.

Does a recovery always happen?

Not necessarily. Within a given dataset a drawdown may still be open at the end, which is why the code checks for it.

Related

Education only. Not investment, tax or trading advice. Simulated results are illustrations; past data does not predict future returns.