plotPerformance {Strategy}R Documentation

Plot Strategy Performance

Description

Plots performance of an object of class Strategy.

Usage

plotPerformance(object, which = NULL, of = "portfolio", from = NULL,
  until = NULL, use.backtest = FALSE, include.costs = TRUE,
  plot.params = TRUE, plot.params.names = NULL, plot.params.first = TRUE,
  ...)

## S4 method for signature 'Strategy'
plotPerformance(object, which = NULL,
  of = c("portfolio", "assets"), from = NULL, until = NULL,
  use.backtest = FALSE, include.costs = TRUE, plot.params = TRUE,
  plot.params.names = NULL, plot.params.first = TRUE, ...)

Arguments

object

An object of class Strategy.

which

Names or number of assets that should be included in performance. If a portfolio performance from only a subset of the assets is calculated, the weights are scaled accordingly.

of

Performance to be extracted from assets separately or the portfolio performance.

from

The date in character format "yyyy-MM-dd" or as date-object from which performance shall be plotted. If NULL, the start date of the performances is used.

until

The date in character format "yyyy-MM-dd" or as date-object until which performance shall be plotted. If NULL, the end date of the performances is used.

use.backtest

If TRUE, the signals from the backtesting output are considered for performance calculation. If FALSE, the signals from the normal strategy execution with the intial parameters are used.

include.costs

If FALSE, the fixed and relative trading costs are NOT considered for performance calculation. Default value is TRUE. As default values for costs are 0, this argument is redundant if no costs are given.

plot.params

If set to TRUE, the parameters used for the performance periods are plotted into the chart. Requires that use.backtest is set to TRUE.

plot.params.names

New parameter names to be shown can be supplied. Requires that use.backtest is set to TRUE to take effect.

plot.params.first

If TRUE, the parameter for the first period is plotted. Otherwise, the parameters are plot at the point on the x-axis, from which they are valid. Requires that use.backtest is set to TRUE to take effect.

...

Further arguments that can be passed to the underlying plot()-function.

Examples

##Not run:

# MA(200)-Strategy
params <- list(k=200)
myStrat.MA <- Strategy(assets=assets, strat="MA", strat.params=params)

# Plot MA(200)-Strategy
plotPerformance(myStrat.MA, from="2015-01-01", until="2015-12-31")

# Plot backtested MA(200)-Strategy
# plotPerformance(myStrat.MA, from="2015-01-01", until="2015-12-31", use.backtest=TRUE)

##End(Not run)

[Package Strategy version 1.0.1 Index]