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 The series the index is calculated on. length required series int How many bars the calculation covers. 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)