Lesson 10 of 15

Recovery Time

Recovery Time

Recovery time measures how many periods it takes to climb back to the pre-drawdown peak after the maximum drawdown trough. It is an important complement to max drawdown: a deep but quick recovery is very different from a shallow but prolonged one.

Algorithm

  1. Compute drawdowns to find the maximum drawdown value
  2. Find the trough index (where the max drawdown occurs)
  3. Before the trough, find the peak index (the last point achieving that high-water mark)
  4. Scan forward from the trough to find the first index where equity >= peak_value
  5. Recovery time = that index − peak index
  6. If never recovered, return −1

Example

Equity: [100, 110, 105, 95, 100, 108, 115]

  • Peak = 110 at index 1
  • Trough = 95 at index 3
  • Recovery: index 6 (value 115 ≥ 110)
  • Recovery time = 6 − 1 = 5

Equity: [100, 120, 100, 80, 90, 110]

  • Peak = 120 at index 1; never recovers → −1
Python runtime loading...
Loading...
Click "Run" to execute your code.