Learn R Programming

TTR (version 0.13-1)

ttr.tools: Miscellaneous Tools

Description

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

Usage

growth(price, signals, ...)
  rollFUN(x, n, FUN, ...)
  lags(x, n = 1)
  wilderSum(x, n = 10)

Arguments

price
Price series to use.
signals
Signals to use (defaults to vector of ones). Use 0 for no position, 1 for long position, and -1 for short position.
x
Object able to be coerced to a matrix.
n
Number of periods to use.
FUN
Function to calculate over rolling subsets of data.
...
Further arguments to be passed from or to other methods.

Value

  • growth returns a vector of the growth of the investment. rollFUN returns a vector of function results for the rolling subsets of data. lags returns a matrix of lagged values of the original vector. wilderSum returns a vector of weighted sums.

Details

growth calculates the growth of an investment using given prices and signals. rollFUN allows the calculation of rolling functions. lags calculates the lags of a given series. wilderSum calculates a Welles Wilder style weighted sum.