Learn R Programming

PMwR (version 0.11-0)

drawdowns: Compute Drawdowns

Description

Compute drawdown statistics.

Usage

drawdowns(x, …)
# S3 method for default
drawdowns(x, …)
# S3 method for zoo
drawdowns(x, …)

Arguments

x

a numeric vector of prices

additional arguments, to be passed to methods

Value

a data.frame

Details

drawdowns is a generic function. It computes drawdown statistics: maximum; and time of peak, trough and recovery.

References

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/

See Also

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.

Examples

Run this code
# 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