Lipi Reference Lipi

Functions

talib.cci()

The CCI (commodity channel index) is calculated as the difference between the typical price of a commodity and its simple moving average, divided by the mean absolute deviation of the typical price. The index is scaled by an inverse factor of 0.015 to provide more readable numbers.

Syntax

                talib.cci(series float source, series int length) → series float
              

Arguments

source required series float Series of values to process.
length required series int Number of bars (length).

Return Type

series float

Example


          indicator("CCI Indicator", overlay=false)
// User inputs
length = input(20, title="CCI Length")
// Compute CCI
cciValue = ta.cci(close, length)
// Plot CCI
plot(cciValue, title="CCI", color=color.blue, linewidth=2)
// Overbought/Oversold Levels
hline(100, "Overbought", color=color.green)
hline(0, "Neutral", color=color.gray)
hline(-100, "Oversold", color=color.red)