changes {TTR}R Documentation

Rate of Change / Momentum

Description

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

Usage

  ROC(x, n=1, type=c("continuous", "discrete"), na=NA)
  momentum(x, n=1, na=NA)

Arguments

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.

Details

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

Value

ROC returns a vector containing the rate-of-change (or return) values.
momentum returns a vector containing the differenced price series.

Author(s)

Josh Ulrich

Examples

  data(ttrc)
  roc <- ROC(ttrc[,"Close"])
  mom <- momentum(ttrc[,"Close"])

[Package TTR version 0.14-0 Index]