Rs
Module 9Returns & VolatilityLesson 3 of 818 min

Drawdown Basics

Running peak and max drawdown on a wealth path.

Drawdown

DD_t = (peak_t - value_t) / peak_t

Max drawdown

Maximum of DD_t over the sample — key risk stat for strategies.

Algorithm

Track running max; update DD.

Challenge

Also return the index where max DD trough occurs.

Tips
  • Peak must update first
  • DD is unitless fraction
  • Useful for strategy labs

Try it live

Drawdown BasicsRust 2021
Loading editor…
Output
Press Run to compile and execute.