drawdown | R Documentation |
Compute the drawdown of a time series.
drawdown(v, relative = TRUE, summary = TRUE)
v |
a price series (a numeric vector) |
relative |
if |
summary |
if |
The drawdown at position t of a time series v is the difference between the highest peak that was reached before t and the current value. If the current value represents a new high, the drawdown is zero.
If summary
is FALSE
, a vector of the same length as
v
. If summary
is TRUE
, a list
maximum |
maximum drawdown |
high |
the max of |
high.position |
position of |
low |
the min of |
low.position |
position of |
Enrico Schumann
Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/C2017-0-01621-X")}
Schumann, E. (2023) Financial Optimisation with R (NMOF Manual). https://enricoschumann.net/NMOF.htm#NMOFmanual
drawdowns
v <- cumprod(1 + rnorm(20) * 0.02)
drawdown(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.