ta.cci
Measure how far price sits from its average, in units of typical deviation.
ta.cci(source, length)Commodity Channel Index: (source - sma(source, length)) / (0.015 * ta.dev(source, length)), where ta.dev is the mean absolute deviation about that same average, not a standard deviation. The 0.015 is the original scaling constant.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | Typically hlc3. |
length | Constant | number | 20 | 1 to 10000 | Window in observed bars. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
lengthbars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive non-na observations are in the window. An na resets the accumulation. na when the mean absolute deviation over the window is zero.
Example
ta.cci(hlc3, 20)plot(ta.cci(hlc3, 20), "Channel index 20")