quantstrat (version 0.11.0)

add.signal: add a signal to a strategy

Description

This adds a signal definition to a strategy object.

Usage

add.signal(strategy, name, arguments, parameters = NULL, label = NULL, ...,
  enabled = TRUE, indexnum = NULL, store = FALSE)

Arguments

strategy

an object (or the name of an object) of type 'strategy' to add the signal to

name

name of the signal, must correspond to an R function

arguments

named list of default arguments to be passed to an signal function when executed

parameters

vector of strings naming parameters to be saved for apply-time definition,default NULL, only needed if you need special names to avoid argument collision

label

arbitrary text label for signal output, default NULL

...

any other passthru parameters

enabled

TRUE/FALSE whether the signal is enabled for use in applying the strategy, default TRUE

indexnum

if you are updating a specific signal, the index number in the $signals list to update

store

TRUE/FALSE whether to store the strategy in the .strategy environment, or return it. default FALSE

Value

if strategy was the name of a strategy, the name. It it was a strategy, the updated strategy.

Details

Signals denote times at which the strategy may want to take action. Common signals types from the literature include crossovers, thresholds, or other interactions between your mktdata and your indicators.

if label is not supplied, NULL default will be converted to '<name>.sig' if the signal function returns one named column, we use that, and ignore the label. If the signal function returns multiple columns, the label will be paste'd to either the returned column names or the respective column number.

See Also

applySignals add.indicator link{add.rule} sigComparison sigCrossover sigFormula sigPeak sigThreshold