Skip to content

IIndicatorsAccessor.CommodityChannelIndex

method · IIndicatorsAccessor · cAlgo.API.Internals

DesktopCLICloud

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

Overloads

CommodityChannelIndex(int periods)

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

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

Parameters

Name C# type Python type Description
periods int int The value of the periods used for calculation.

Returns CommodityChannelIndex — Commodity Channel Index indicator instance.

Examples

var cci = Indicators.CommodityChannelIndex(20);
if (cci.Result.LastValue > 100)
    Print("CCI(20) is above 100: {0}", cci.Result.LastValue);
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.

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

Parameters

Name C# type Python type Description
source DataSeries DataSeries The source data used for calculation.
periods int int The value of the periods used for calculation.

Returns CommodityChannelIndex — Commodity Channel Index indicator instance.

Examples

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