Learn R Programming

TTR (version 0.21-1)

TDI: Trend Detection Index

Description

The Trend Detection Index (TDI) attempts to identify starting and ending trends. Developed by M. H. Pee.

Usage

TDI(price, n=20, multiple=2)

Arguments

price
Price series that is coercible to xts or matrix.
n
Number of periods to use.
multiple
Multiple used to calculate (2).

Value

  • A object of the same class as price or a matrix (if try.xts fails) containing the columns:
  • tdiThe Trend Detection Index.
  • diThe Direction Indicator.

Details

The TDI is the (1) absolute value of the n-day sum of the n-day momentum, minus the quantity of (2) multiple*n-day sum of the absolute value of the n-day momentum, minus (3) n-day sum of the absolute value of the n-day momentum.

I.e. TDI = (1) - [ (2) - (3) ]

The direction indicator is the sum of the n-day momentum over the last n days.

See URL in references section for further details.

References

The following site(s) were used to code/document this indicator: http://www.linnsoft.com/tour/techind/tdi.htm

See Also

See aroon, CCI, ADX, VHF, GMMA for other indicators that measure trend direction/strength.

Examples

Run this code
data(ttrc)
  tdi <- TDI(ttrc[,"Close"], n=30)

Run the code above in your browser using DataLab