Description Usage Arguments Value Examples
View source: R/breakoutSignal.R
This function will return a vector of buy/sell signals based on whether
or not the current value of x
is above the maximum or below the minimum price of
x
over the lookback period. If the current price is above the maximum, the return
value is 1. If the current price is below the minumum, then the return value is -1. Otherwise,
the return entry will be the previous signal. The return vector will be of length
x
- lookback
. This function aids in building a smooth
momentum signal by calling simpSignal() with many values of lookback
and averaging the results.
1 | breakoutSignal(x, lookback = 12)
|
x |
an xts object of prices. |
lookback |
the length of the look back period over which to evalute the momentum signal. |
an xts object of discrete momentum signals drawn from the set c(-1,1), where -1 indicates "short" or "sell" and 1 indicates "long" or "buy".
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.