---
id: "M:cAlgo.API.Internals.IIndicatorsAccessor.CommodityChannelIndex(System.Int32)"
kind: "method"
type: "T:cAlgo.API.Internals.IIndicatorsAccessor"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/CommodityChannelIndex/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# IIndicatorsAccessor.CommodityChannelIndex

Member of [IIndicatorsAccessor](https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/index.md).

## CommodityChannelIndex(int periods)

The Commodity Channel Index identifies overbought and oversold conditions, price reversals and trend strength.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
CommodityChannelIndex CommodityChannelIndex(int periods)
```

Python:

```python
api.Indicators.CommodityChannelIndex(periods: int) -> CommodityChannelIndex
```

### Parameters

- `periods` (`int`, Python `int`): The value of the periods used for calculation.

### Returns

`CommodityChannelIndex` — Commodity Channel Index indicator instance.

### Examples

C#:

```csharp
var cci = Indicators.CommodityChannelIndex(20);
if (cci.Result.LastValue > 100)
    Print("CCI(20) is above 100: {0}", cci.Result.LastValue);
```

Python:

```python
cci = api.Indicators.CommodityChannelIndex(20)
if cci.Result.LastValue > 100:
    api.Print(f"CCI(20) is above 100: {cci.Result.LastValue}")
```

## CommodityChannelIndex(DataSeries source, int periods)

The Commodity Channel Index identifies overbought and oversold conditions, price reversals and trend strength.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
CommodityChannelIndex CommodityChannelIndex(DataSeries source, int periods)
```

Python:

```python
api.Indicators.CommodityChannelIndex(source: DataSeries, periods: int) -> CommodityChannelIndex
```

### Parameters

- `source` (`DataSeries`, Python `DataSeries`): The source data used for calculation.
- `periods` (`int`, Python `int`): The value of the periods used for calculation.

### Returns

`CommodityChannelIndex` — Commodity Channel Index indicator instance.

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
var cci = Indicators.CommodityChannelIndex(Bars.TypicalPrices, 20);
Print("CCI(20) of typical prices: {0}", cci.Result.LastValue);
```

Python:

```python
cci = api.Indicators.CommodityChannelIndex(api.Bars.TypicalPrices, 20)
api.Print(f"CCI(20) of typical prices: {cci.Result.LastValue}")
```

