Learn R Programming

quantstrat (version 0.16.7)

sigThreshold: generate a threshold signal

Description

Many strategies, including RSI or MACD styles, make trading decisions when an indicator is over or under a specific threshold. This function generates the appropriate signal based on such a threshold.

Usage

sigThreshold(label, data = mktdata, column, threshold = 0,
  relationship = c("gt", "lt", "eq", "gte", "lte"), cross = FALSE)

Arguments

label

text label to apply to the output

data

data to apply comparison to

column

named column to apply comparison to

threshold

numeric threshold to test for

relationship

one of c("gt","lt","eq","gte","lte") or reasonable alternatives

cross

if TRUE, will return TRUE only for the first observation to cross the threshold in a run