cci
Commodity Channel Index
cci(period)
Parameters
| Name | Type | Description |
|---|---|---|
period |
int | Number of periods for calculation |
Formula
```
CCI = (Typical Price - SMA(Typical Price)) / (0.015 * Mean Deviation)
Where:
- Typical Price = (High + Low + Close) / 3
- Mean Deviation = Average absolute deviation from SMA
- Constant 0.015 ensures ~70-80% of values fall between ±100
```
Examples
cci(20); # Standard 20-period CCI
cci(14); # 14-period CCI (more sensitive)
cci(20) > 100; # Overbought condition
cci(20) < -100; # Oversold condition
Returns
CCI value (typically ranges from -200 to +200, most values between ±100) ## References - TradingView: `ta.cci()` - Developed by Donald Lambert ## Notes - Values > +100 indicate overbought conditions - Values < -100 indicate oversold conditions - Returns 0 when mean deviation is 0 or NULL - Unbounded oscillator (can exceed ±100)