This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Monte Carlo analysis of transactions | |
| #' | |
| #' Running simulations with similar properties as the backtest or production | |
| #' portfolio may allow the analyst to evaluate the distribution of returns | |
| #' possible with similat trading approaches and evaluate skill versus luck or | |
| #' overfitting. | |
| #' | |
| #' @details | |
| #' | |
| #' If \code{update=TRUE} (the default), the user may wish to pass \code{Interval} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Monte Carlo simulate strategy results | |
| #' | |
| #' Return bands of returns based on Monte Carlo simulations of back-test results | |
| #' @param Portfolio string identifier of portfolio name | |
| #' @param Account string identifier of account name | |
| #' @param n number of simulations, default = 1000 | |
| #' @param \dots any other passthrough parameters | |
| #' @param l block length, default = 20 | |
| #' @param use determines whether to use 'daily' or 'txn' PL, default = "equity" ie. daily | |
| #' @param gap numeric number of periods from start of series to start on, to eliminate leading NA's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Record script start time ---------------------------------------- | |
| t1 <- Sys.time() | |
| # Load required packages ------------------------------------------ | |
| library(quantmod) | |
| library(TTR) | |
| library(PerformanceAnalytics) | |
| library(ggplot2) | |
| library(timeSeries) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Record script start time ---------------------------------------- | |
| t1 <- Sys.time() | |
| # Load required packages ------------------------------------------ | |
| library(quantmod) | |
| # Build the function ---------------------------------------------- | |
| mcblocksim <- function(R, l){ | |
| # Read price data and build xts object |
NewerOlder