changes {TTR} | R Documentation |
Calculate the (rate of) change of a series over n
periods.
ROC(x, n=1, type=c("continuous", "discrete"), na=NA) momentum(x, n=1, na=NA)
x |
Price, volume, etc. series to use. |
n |
Number of periods to use. |
type |
Compounding type; either "continuous" (the default) or "discrete" . |
na |
How should periods prior to n be represented? Default is NA . |
The ROC indicator provides the percentage difference of a series over two observations, while the momentum indicator simply provides the difference.
ROC
returns a vector containing the rate-of-change (or return) values.
momentum
returns a vector containing the differenced price series.
Josh Ulrich
data(ttrc) roc <- ROC(ttrc[,"Close"]) mom <- momentum(ttrc[,"Close"])