CCI: Commodity Channel Index

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

The Commodity Channel Index (CCI) attempts to identify starting and ending trends.

Usage

1
  CCI(HLC, n = 20, maType, c = 0.015, ...)

Arguments

HLC

Object that is coercible to xts or matrix and contains High-Low-Close prices. If only a univariate series is given, it will be used. See details.

n

Number of periods for moving average.

maType

A function or a string naming the function to be called.

c

Constant to apply to the mean deviation.

...

Other arguments to be passed to the maType function.

Details

CCI relates the current price and the average of price over n periods. The CCI usually falls in a channel of -100 to 100. A basic CCI trading system is: Buy (sell) if CCI rises above 100 (falls below -100) and sell (buy) when it falls below 100 (rises above -100).

CCI is usually calculated using the typical price, but if a univariate series (e.g. Close, Weighted Close, Median Price, etc.) is provided, it will be used instead.

Value

A object of the same class as HLC or a vector (if try.xts fails) containing the CCI values.

Note

If HLC is a High-Low-Close matrix, then typical price will be calculated. If HLC is a vector, then those values will be used instead of the typical price.

Author(s)

Joshua Ulrich

References

The following site(s) were used to code/document this indicator:
http://www.fmlabs.com/reference/CCI.htm
http://www.equis.com/Customer/Resources/TAAZ/?c=3&p=42
http://www.linnsoft.com/tour/techind/cci.htm
http://stockcharts.com/education/IndicatorAnalysis/indic_CCI.html

See Also

See EMA, SMA, etc. for moving average options; and note Warning section. See aroon, ADX, TDI, VHF, GMMA for other indicators that measure trend direction/strength.

Examples

1
2
data(ttrc)
cci <- CCI(ttrc[,c("High","Low","Close")])

Example output



TTR documentation built on April 15, 2017, 8:31 a.m.

Related to CCI in TTR...