Lipi Reference
Lipi

Functions

talib.cci()

Commodity Channel Index for `source` over `length` bars. The source is an argument rather than a fixed price, so the index can be run on anything a script computes.

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


          //@lipi=2
indicator("CCI Indicator", overlay=false)
// User inputs
length = input(20, title="CCI Length")
// Compute CCI
cciValue = talib.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)