CCI
CCI
Summary
Commodity Channel Index: measures the current typical price relative to its simple moving average, scaled by mean absolute deviation. Momentum oscillator flagging overbought/oversold extremes. CCI > +100 overbought; CCI < -100 oversold.
Formula
TP_i = (High_i + Low_i + Close_i)/3
SMA = (1/N) * sum(TP over N bars)
meanDev = (1/N) * sum(|TP - SMA| over N bars)
CCI = (TP_last - SMA) / (0.015 * meanDev)
Inputs
inHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outReal— CCI value per bar
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 14 | 2–100000 | Number of bars in the averaging/deviation window |
Properties
Numerical Stability: Start-Independent
| Display Flags |
|---|
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
Implementation
TA-Lib Definition: cci.c · cci.yaml
| Native | File |
|---|---|
| C | ta_CCI.c |
| Rust | cci.rs |
| Java | Core_CCI.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Commodity Channel Index
See Also
References
- Donald Lambert