best.is.strategies {matiming} | R Documentation |
This function reports the best trading strategies in a back-test
best.is.strategies(results, to.annual=sqrt(12), plot.results=FALSE)
results |
the results returned by function |
to.annual |
a coefficient used to annualize the performance measure. For example, when
the performance is measured using either |
plot.results |
a logical value indicating whether to plot the cumulative returns to the best trading strategies and to the buy-and-hold strategy |
An object of class data.frame
containing three columns: Rank
, Rule
, and Performance
.
Other strategy summary functions:
descriptive.statistics()
## Not run: library(matiming) library(xtable) library(zoo) data <- sp500.monthly dates <- index(data) data <- coredata(data) capret <- data[,"CAP"] totret <- data[,"TOT"] rfret <- data[,"RF"] tc <- 0.0025 fast <- 1:9 slow <- 2:18 res.mac <- sim.mac.strategy(totret=totret, rfret=rfret, dates=dates, capret=capret, tc=tc, fast=fast, slow=slow, FUN=SMA) res.mom <- sim.mom.strategy(totret=totret, rfret=rfret, dates=dates, capret=capret, tc=tc, winsize=slow) results <- sim.results.merge(res.mac, res.mom) start.date <- as.Date("1950-01-01", format="%Y-%m-%d") end.date <- as.Date("2010-12-31", format="%Y-%m-%d") n.first <- 10 include.bh <- TRUE res <- back.test(results, start.date=start.date, end.date=end.date, n.first=n.first, include.bh=include.bh, FUN=Sharpe) df <- best.is.strategies(res, plot.results=TRUE) xtab <- xtable(df, digits=3) print(xtab, include.rownames=FALSE) ## End(Not run)