ROC

0th

Percentile

Rate of Change / Momentum

Calculate the (rate of) change of a series over n periods.

Keywords
ts
Usage
ROC(x, n = 1, type = c("continuous", "discrete"), na.pad = TRUE)

momentum(x, n = 1, na.pad = TRUE)

Arguments
x

Price, volume, etc. series that is coercible to xts or matrix.

n

Number of periods to use.

type

Compounding type; either "continuous" (the default) or "discrete".

na.pad

Should periods prior to n be appended? Default is TRUE.

Details

The ROC indicator provides the percentage difference of a series over two observations, while the momentum indicator simply provides the difference.

Value

A object of the same class as x or a vector (if try.xts fails) containing the rate-of-change (or return) values for ROC or a vector containing the differenced price series for momentum.

Aliases
  • ROC
  • changes
  • momentum
Examples
# NOT RUN {
data(ttrc)
roc <- ROC(ttrc[,"Close"])
mom <- momentum(ttrc[,"Close"])
# }
Documentation reproduced from package TTR, version 0.23-6, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.