Learn R Programming

TTR (version 0.24.4)

lags: Miscellaneous Tools

Description

Various functions that may be useful in designing technical trading rules.

Usage

lags(x, n = 1)

growth(price, signals, ...)

naCheck(x, n = 0)

Value

growth returns a vector of the growth of the investment.

lags returns a matrix of lagged values of the original vector.

Arguments

x

Object that is coercible to xts or matrix.

n

Number of periods to use.

price

Price series that is coercible to xts or matrix.

signals

Signals to use (defaults to vector of ones). Use '0' for no position, '1' for long position, and '-1' for short position.

...

Further arguments to be passed from or to other methods.

Author

Joshua Ulrich

Details

growth calculates the growth of an investment using given prices and signals.

lags calculates the lags of a given series.