oos.outperformance.plot {matiming}R Documentation

Plots the rolling outperformance of the OOS strategy

Description

This function plots the rolling outperformance of the out-of-sample trading strategy

Usage

oos.outperformance.plot(results, start.date, split.date, end.date)

Arguments

results

the results returned by function forward.test

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

Value

None

Note

The argument results contains, among other variables, the dates vector that defines the historical period over which the trading strategies are simulated. The outperformance is defined as the difference between the performance of a trading strategy and the performance of the corresponding passive strategy.

See Also

Other plotting functions: is.outperformance.plot()

Examples

## Not run: 
library(matiming)
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("1930-01-01", format="%Y-%m-%d")
end.is.date <- as.Date("1949-12-31", format="%Y-%m-%d")
end.oos.date <- as.Date("2015-12-31", format="%Y-%m-%d")

res <- forward.test(results, start.date=start.date, end.is.date=end.is.date,
                    end.oos.date=end.oos.date)

# plot the rolling outperformance
start.date <- as.Date("1950-01-01", format="%Y-%m-%d")
split.date <- as.Date("1954-12-31", format="%Y-%m-%d")
end.date <- as.Date("2015-12-31", format="%Y-%m-%d")

oos.outperformance.plot(res, start.date=start.date, split.date=split.date,
                        end.date=end.date)

## End(Not run)

[Package matiming version 1.0 Index]