Description Usage Arguments Value Author(s) References See Also Examples
Calculate ratio of investment return to investment risk based on a vector of prices or gains. The formula is growth rate / mdd, where growth rate is the growth of an investment over some time period and mdd is the maximum drawdown over that time period.
1 2 3 4 |
prices |
Numeric vector of investment prices (typically daily closing prices). |
gains |
Numeric vector of gains. |
highs |
Numeric vector of daily highs. |
lows |
Numeric vector of daily lows. |
nas |
If |
Numeric value indicating the risk-return ratio.
Dane R. Van Domelen
Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.
gains.rate
, prices.rate
, mdd
,
sharpe.ratio
, sortino.ratio
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Randomly generate daily stock gains over a 5-year period
set.seed(123)
stock.gains <- rnorm(252 * 5, 0.0005, 0.01)
# Convert to daily balances assuming an initial balance of $10,000
daily.balances <- balances(stock.gains + 1)
# Total return is about 1.23
daily.balances[length(daily.balances)] / daily.balances[1] - 1
# Maximum drawdown is about 0.19
mdd(daily.balances)
# Ratio of these two is about 6.48
(daily.balances[length(daily.balances)] / daily.balances[1] - 1) /
mdd(daily.balances)
# Easier to calculate using rrr function
rrr(daily.balances)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.