applyStrategy: apply the strategy to arbitrary market data

Description Usage Arguments Details See Also

Description

This function is the wrapper that holds together the execution of a strategy.

Usage

1
2
3
applyStrategy(strategy, portfolios, mktdata = NULL, parameters = NULL, ...,
  debug = FALSE, symbols = NULL, initStrat = FALSE, updateStrat = FALSE,
  gc = FALSE, delorders = FALSE)

Arguments

strategy

an object of type 'strategy' to add the indicator to

portfolios

a list of portfolios to apply the strategy to

mktdata

an xts object containing market data. depending on indicators, may need to be in OHLCV or BBO formats, default NULL

parameters

named list of parameters to be applied during evaluation of the strategy, default NULL

...

any other passthru parameters

debug

if TRUE, return output list

symbols

character vector identifying symbols to initialize a portfolio for, default NULL

initStrat

whether to use (experimental) initialization code, default FALSE

updateStrat

whether to use (experimental) wrapup code, default FALSE

gc

if TRUE, call gc after each symbol run, default FALSE (experimental)

delorders

if TRUE, delete the order book for a symbol at the end of the symbols loop, will cause issues with rebalancing, default FALSE (experimental)

Details

After the straetgy object has been created, it may be applied to any combination of symbols and parameters.

The symbols to be utilized will be defined in one of two ways, either by specifying a name of a portfolio that has already been initialized with the portfolios argument, or be specifying a symbols argument in addition to setting initStrat=TRUE.

applyStrategy will use the R core function get to load market data for each symbol during stategy evaluation unless the user passes mktdata in the call to applyStrategy

See Also

strategy, applyIndicators, applySignals, applyRules, initStrategy,


redmode/quantstrat documentation built on May 27, 2019, 4:04 a.m.