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.
sigThreshold(label, data = mktdata, column, threshold = 0, relationship = c("gt", "lt", "eq", "gte", "lte"), cross = FALSE)
text label to apply to the output
data to apply comparison to
named column to apply comparison to
numeric threshold to test for
one of c("gt","lt","eq","gte","lte") or reasonable alternatives
if TRUE, will return TRUE only for the first observation to cross the threshold in a run