Description Usage Arguments Value Examples

Calculates maximum drawdown from vector of closing prices, highs and lows, or gains.

1 2 |

`prices` |
Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one). |

`highs` |
Numeric vector of daily high prices. |

`lows` |
Numeric vector of daily low prices. |

`gains` |
Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one). |

`indices` |
Logical value for whether to include indices for when the maximum drawdown occurred. |

Numeric value, vector, or matrix depending on `indices`

and whether
there is 1 fund or several.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## Not run:
# Simulate minute-to-minute stock gains over a 2-year period
set.seed(123)
stock.gains <- rnorm(6.5 * 60 * 252 * 2, 0.000005, 0.001)
# Convert to stock prices assuming an initial price of $9.50 per share
stock.prices <- gains_prices(gains = stock.gains, initial = 9.50)
# Plot minute-to-minute stock prices (200k data point, may be slow)
plot(stock.prices)
# Maximum drawdown based on stock prices
mdd(prices = stock.prices)
# Same answer using gains rather than prices
mdd(gains = stock.gains)
## End(Not run)
``` |

stocks documentation built on May 2, 2019, 9:43 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.