add.signal: add a signal to a strategy

Description Usage Arguments Details Value See Also

View source: R/signals.R

Description

This adds a signal definition to a strategy object.

Usage

1
2
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

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.

Value

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

See Also

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


cloudcell/quantstrat documentation built on May 13, 2019, 8:03 p.m.