# 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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab