Compute drawdown statistics.
drawdowns(x, …)
# S3 method for default
drawdowns(x, …)
# S3 method for zoo
drawdowns(x, …)
a numeric
vector of prices
additional arguments, to be passed to methods
drawdowns
is a generic function. It computes drawdown
statistics: maximum; and time of peak, trough and recovery.
Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626
Schumann, E. (2018) Portfolio Management with R. http://enricoschumann.net/PMwR/
The actual computation of the drawdowns is done by function
drawdown
in package NMOF.
Series of uninterrupted up and down movements can be computed
with streaks
.
# NOT RUN {
x <- c(100, 98)
drawdowns(x)
x <- c(100, 98, 102, 99)
dd <- drawdowns(x)
dd[order(dd$max, decreasing = TRUE), ]
# }
Run the code above in your browser using DataLab