Let’s say we have a time series of portfolio returns, in percentages:
portReturns <- ts(rnorm(30)) #randomly generated 'returns'
portReturns #show the first handful of 'returns'
## Time Series:
## Start = 1
## End = 30
## Frequency = 1
## [1] 0.67616342 0.07398030 -0.61932880 0.21041818 -0.76346086
## [6] -0.82951638 1.57191386 0.08774548 0.02411848 1.01011886
## [11] -0.77200624 0.39298838 1.96212242 -0.66670138 -0.04075096
## [16] -0.89394127 0.26163506 0.74785858 -1.20744080 1.13539527
## [21] -0.68981343 0.70767474 1.45024932 0.67600472 -0.99920754
## [26] -1.71959460 -0.70442081 0.11580595 -0.20839502 -0.44757219
Let’s plot them:
plot(portReturns, main='returns')
We see the typical whitenoise-like pattern.
Now let’s find the cumulative sum of those returns, which will show the change in the value of our portfolio over time:
portReturnsCumu <- ts(cumsum(portReturns))
plot(portReturnsCumu, main = 'Cumulative returns/Portfolio value')
Let’s visually find when the portfolio reaches it’s maximum value, before losing value, for the first time. Then find when it recovers from that trough. That period of loss after a peak, is a period of drawdown.
Let’s make it easy to identify these periods by plotting a line, showing the running max value reached by the portfolio:
plot(portReturnsCumu, main = 'Cumulative returns/Portfolio value with Running Max')
portReturnsCumuMax <- cummax(portReturnsCumu)
lines(portReturnsCumuMax, col='red')
Whenever the value of the portfolio (black line) is below the running max (red line), that is a period of drawdown
Now that we can find drawdowns visually, how do we compute them, so we can plot them on their own?
portDrawdowns <- portReturnsCumuMax - portReturnsCumu
everything <- data.frame(portReturnsCumuMax,
portReturnsCumu,
portDrawdowns)
colnames(everything) <- c('Portfolio Running Max Value','Portfolio Value', 'Drawdown')
head(everything)
## Portfolio Running Max Value Portfolio Value Drawdown
## 1 0.6761634 0.6761634 0.0000000
## 2 0.7501437 0.7501437 0.0000000
## 3 0.7501437 0.1308149 0.6193288
## 4 0.7501437 0.3412331 0.4089106
## 5 0.7501437 -0.4222278 1.1723715
## 6 0.7501437 -1.2517441 2.0018879
It’s just subtraction: Column 1 - Column 2 = Drawdown
Now lets plot the drawdowns on their own:
plot(portDrawdowns, main = 'Drawdowns')
You’re probably noticing that these are positve values. Drawdowns are positive. In order to turn this into an underwater plot, we simply reflect the drawdowns across the x-axis:
plot(-portDrawdowns, main = 'Underwater plot')
From what I’ve read, a trader named Jack Schwager thought this way of presenting the info better emphasized that we’re dealing with reductions in portfolio value, than did plotting positive values.