is.outperformance.plot {matiming} | R Documentation |
This function plots the trading strategies rolling outperformance
is.outperformance.plot(results, start.date, split.date, end.date, FUN=Sharpe)
results |
the results of the back-test or simulation of a trading strategy or multiple trading strategies.
The former is the result returned by function |
start.date |
the start of the first rolling period |
split.date |
the end of the first rolling period |
end.date |
the end of the total period |
FUN |
the function that computes the performance of a trading strategy. The function |
None
The argument results
contains the dates vector that defines the historical period
over which the trading strategies are simulated. The function FUN
is only used if results
is the result of simulation.
The outperformance is defined as the difference between the performance of a trading strategy and the performance of
the corresponding passive strategy. The number of plotted strategies is limited by 5.
Other plotting functions:
oos.outperformance.plot()
## Not run: library(matiming) library(zoo) # access the data data <- sp500.monthly dates <- index(data) data <- coredata(data) capret <- data[,"CAP"] totret <- data[,"TOT"] rfret <- data[,"RF"] # simulate the SMA(10) strategy tc <- 0.0025 fast <- 1 slow <- 10 shorts <- F results <- sim.mac.strategy(totret=totret, rfret=rfret, dates=dates, capret=capret, tc=tc, shorts=shorts, fast=fast, slow=slow, FUN=SMA) # plot the rolling outperformance start.date <- as.Date("1920-01-01", format="%Y-%m-%d") split.date <- as.Date("1929-12-31", format="%Y-%m-%d") end.date <- as.Date("2015-12-31", format="%Y-%m-%d") is.outperformance.plot(results, start.date=start.date, split.date=split.date, end.date=end.date, FUN=Sharpe) ## End(Not run)