indicator · own pane · open source
Commodity Channel Index
Running…
Loading chart…
About
Commodity Channel Index (CCI) measures how far the typical price has wandered from its moving average in units of mean deviation.
- Above +100 = strong bullish momentum, below -100 = strong bearish.
- Zero-line crossings are momentum shifts.
- Raise
Lengthto suppress noise in chop.
Source code
//@version=5
indicator("Commodity Channel Index", overlay=false)
len = input.int(20, "Length", minval=2, maxval=200)
src = input.source("close", "Source")
cci = ta.cci(src, len)
hline(100, "Overbought", color=color.gray, linestyle=hline.style_dashed)
hline(-100, "Oversold", color=color.gray, linestyle=hline.style_dashed)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
p_CCI = plot(cci, "CCI", color=color.teal, linewidth=2)
alertcondition(ta.crossover(cci, 100), "CCI overbought", "CCI crossed above +100")
alertcondition(ta.crossunder(cci, -100), "CCI oversold", "CCI crossed below -100")
No comments yet.
Sign in to comment.