Indicator · Pine Script v6 · Own pane

CCI Advanced [WavesUnchained]

by casoon

CCI Advanced is a versatile momentum oscillator displayed in a separate pane.

View on GitHub

GitHub stars9on the repository
Pine versionv6current
Lines of code410
Settings39inputs
LicenceMIT
Last update3 days ago27 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

410 lines of Pine Script v6 from indicators/momentum/cci_advanced/cci_advanced.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

cci_advanced.pine
//@version=6
// ============================================================================
// CCI Advanced [WavesUnchained]
// Version: 1.4.3
// Author: WavesUnchained
// Build: 2026-10-02 00:00:00
// ============================================================================
// CCI with pluggable smoothing, adaptive scaling, and rich visualization.
// Designed as a standalone oscillator and as context layer for hybrid setups.
//
// Features:
//   ✓ Pluggable smoothing (EMA, SMA, RMA, WMA, SuperSmoother, T3, KAMA, JMA Approx)
//   ✓ Three scale modes: Classic, Clamp ±200, Adaptive ±100
//   ✓ Averaged CCI + signal line with fill
//   ✓ 4-state histogram
//   ✓ Gradient line color (bull ↔ bear based on CCI level)
//   ✓ Gradient shadow fills between CCI and zero
//   ✓ OB/OS zone fills
//   ✓ Extreme zone and zero-line cross signal markers
//   ✓ Stall/absorption context: marks crosses contradicted by flat price as weak
//   ✓ Trend context line (slow CCI): support the fast line rests on; counter-trend crosses marked weak
//   ✓ Trend↔CCI divergence wedge: lights up when fast and trend move opposite (supported dip vs weak bounce)
//   ✓ Sentiment Bar — live ±100 OB/OS extremity score + mini bar
//   ✓ Signal Quality — optional 0-100 conviction score per Bull/Bear cross
//   ✓ Alert conditions
//
// ============================================================================

indicator("CCI Advanced [WavesUnchained]", "CCI·ADV", format=format.price, precision=2, overlay=false, max_labels_count=500)

// ─────────────────────────────────────────────────────────────────────────────
// INPUTS
// ─────────────────────────────────────────────────────────────────────────────

g_cci = "1 · CCI"
src    = input.source(hlc3, "Source",        group=g_cci)
cciLen = input.int(20,      "CCI Length",    minval=1, group=g_cci)
avgLen = input.int(3,       "Average Length", minval=1, group=g_cci,
     tooltip="Smooth the raw CCI before computing the signal. Lengthens the main line without changing the lookback.")
sigLen = input.int(9,       "Signal Length", minval=1, group=g_cci)

g_smooth = "2 · Smoothing"
smoothType = input.string("EMA", "Type",
     options=["EMA", "SMA", "RMA", "WMA", "SuperSmoother", "T3", "KAMA", "JMA Approx"],
     group=g_smooth)
jmaPhase = input.int(50,    "  JMA Phase", minval=-100, maxval=100,             group=g_smooth)
jmaPower = input.float(2.0, "  JMA Power", minval=1.0, maxval=4.0, step=0.25,  group=g_smooth)

g_scale = "3 · Scale"
scaleMode     = input.string("Classic", "Mode",
     options=["Classic", "Clamp ±200", "Adaptive ±100"], group=g_scale,
     tooltip="Classic: raw CCI values (unbounded). Clamp ±200: clips to ±200. Adaptive ±100: rescales to ±100 based on recent range.")
scaleLookback = input.int(200, "Adaptive Lookback", minval=20, group=g_scale)

g_levels = "4 · Levels"
ob1 = input.float( 100, "Overbought 1",  group=g_levels)
ob2 = input.float( 200, "Overbought 2",  group=g_levels)
os1 = input.float(-100, "Oversold 1",    group=g_levels)
os2 = input.float(-200, "Oversold 2",    group=g_levels)

g_filter = "5 · Signal Filters"
useExtremeOnly  = input.bool(true, "Extreme Signals: require OB/OS zone",  group=g_filter)
lookbackExtreme = input.int(5,     "OB/OS Lookback (bars)",                 minval=1, group=g_filter)
showZeroCross   = input.bool(true, "Show Zero-Line Cross Markers",          group=g_filter)

g_col = "6 · Colors"
colBull  = input.color(#00bcd4,               "Bull (CCI level)",  group=g_col,
     tooltip="Oscillator-level / mean-reversion gradient on the fast CCI line.")
colBear  = input.color(#f06292,               "Bear (CCI level)",  group=g_col)
colLong  = input.color(#00c853,               "Long (trend / momentum)",  group=g_col,
     tooltip="Directional long/short coloring for the trend context line and the histogram.")
colShort = input.color(#d50000,               "Short (trend / momentum)", group=g_col)
colZoneOB = input.color(color.new(#f06292, 90), "OB Zone Fill", group=g_col)
colZoneOS = input.color(color.new(#00bcd4, 90), "OS Zone Fill", group=g_col)

g_disp = "7 · Display"
showShadow   = input.bool(true,  "Shadow Fill (CCI vs Zero)", group=g_disp)
showFill     = input.bool(true,  "Fill CCI / Signal",         group=g_disp)
showZoneFill = input.bool(true,  "Fill OB / OS Zones",        group=g_disp)
showHist     = input.bool(true,  "Show Histogram",            group=g_disp)
showSignals  = input.bool(true,  "Show Signal Markers",       group=g_disp)

g_stall = "8 · Stall / Absorption"
useStall     = input.bool(true, "Detect Stall (CCI moves, price holds)", group=g_stall,
     tooltip="Flags bars where the CCI cools/heats sharply but price barely moves — momentum decoupled from price (absorption). Annotates crosses and fades the histogram; never changes the cross logic itself.")
stallLen     = input.int(5,     "Stall Lookback (bars)",   minval=1, group=g_stall)
stallFlatATR = input.float(0.5, "Max Price Move (ATR)",    minval=0.0, step=0.1, group=g_stall,
     tooltip="Price counts as 'holding' if it moved less than this many ATR over the lookback.")
stallCciMin  = input.float(40,  "Min CCI Move",            minval=0,   step=5,   group=g_stall,
     tooltip="The CCI line must cool/heat by at least this much over the lookback to count as a stall.")

g_ctx = "9 · Trend Context"
useCtx = input.bool(true, "Show Trend Context Line", group=g_ctx,
     tooltip="A slow CCI (longer length, same smoothing) plotted faint in the panel — the trend the fast CCI rests on. While it holds its side of zero, an opposite fast cross is treated as counter-trend (weak). Single-timeframe, no MTF.")
ctxLen = input.int(100, "Trend CCI Length", minval=10, group=g_ctx)
showDiv = input.bool(true, "Highlight Trend ↔ CCI Divergence", group=g_ctx,
     tooltip="Fills the wedge between the fast CCI and the trend context line when they move in opposite directions: fast cooling into a rising trend (supported dip, long color) or fast heating into a falling trend (unsupported bounce, short color).")
divLen  = input.int(4,    "Divergence Slope Lookback", minval=1, group=g_ctx)
divMin  = input.float(25, "Min Fast Slope",            minval=0, step=5, group=g_ctx,
     tooltip="The fast CCI must move at least this much over the lookback to count — noise guard for low timeframes. The slow line is already smooth, so its direction (sign) alone is used.")

g_score = "10 · Score"
showSentiment = input.bool(true,  "Show Sentiment Bar", group=g_score,
     tooltip="Live label at the panel's right edge — how far CCI sits inside its own OB/OS zone, signed ±100. Not a fixed Bullish/Bearish claim. Mirrors Williams VIX Fix Advanced's Sentiment Bar.")
showQuality   = input.bool(false, "Show Signal Quality Labels", group=g_score,
     tooltip="Adds a 0-100 quality score next to each Bull/Bear Extreme marker: 50% OB/OS-zone depth + 25% context agreement + 25% stall-free. Mirrors Williams VIX Fix Advanced's Spike Quality.")

// ─────────────────────────────────────────────────────────────────────────────
// SMOOTHING FUNCTIONS
// ─────────────────────────────────────────────────────────────────────────────

f_supersmoother(series float x, simple int len) =>
    float pi = math.pi
    float a1 = math.exp(-1.414 * pi / len)
    float b1 = 2.0 * a1 * math.cos(1.414 * pi / len)
    float c2 = b1
    float c3 = -(a1 * a1)
    float c1 = 1.0 - c2 - c3
    var float ss = na
    ss := c1 * (x + nz(x[1])) / 2.0 + c2 * nz(ss[1]) + c3 * nz(ss[2])
    ss

f_t3(series float x, simple int len) =>
    float b  = 0.7
    float e1 = ta.ema(x, len)
    float e2 = ta.ema(e1, len)
    float e3 = ta.ema(e2, len)
    float e4 = ta.ema(e3, len)
    float e5 = ta.ema(e4, len)
    float e6 = ta.ema(e5, len)
    float c1 = -(b * b * b)
    float c2 =  3.0 * b * b + 3.0 * b * b * b
    float c3 = -6.0 * b * b - 3.0 * b - 3.0 * b * b * b
    float c4 =  1.0 + 3.0 * b + b * b * b + 3.0 * b * b
    c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3

f_kama(series float x, simple int len) =>
    float change   = math.abs(x - x[len])
    float vol      = math.sum(math.abs(x - x[1]), len)
    float er       = vol != 0.0 ? change / vol : 0.0
    float sc       = math.pow(er * (2.0 / 3.0 - 2.0 / 31.0) + 2.0 / 31.0, 2)
    var float kama = na
    kama := nz(kama[1], x) + sc * (x - nz(kama[1], x))
    kama

f_jma(series float x, simple int len, simple int phase, simple float power) =>
    var float jma = na
    var float e0  = na
    var float e1  = na
    var float e2  = na
    float phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100.0 + 1.5
    float beta       = 0.45 * (len - 1) / (0.45 * (len - 1) + 2.0)
    float alpha      = math.pow(beta, power)
    e0  := (1.0 - alpha) * x + alpha * nz(e0[1], x)
    e1  := (x - e0) * (1.0 - beta) + beta * nz(e1[1], 0.0)
    e2  := (e0 + phaseRatio * e1 - nz(jma[1], x)) * math.pow(1.0 - alpha, 2.0) + math.pow(alpha, 2.0) * nz(e2[1], 0.0)
    jma := nz(jma[1], x) + e2
    jma

f_smooth(series float x, simple int len, simple string mode) =>
    switch mode
        "SMA"           => ta.sma(x, len)
        "RMA"           => ta.rma(x, len)
        "WMA"           => ta.wma(x, len)
        "SuperSmoother" => f_supersmoother(x, len)
        "T3"            => f_t3(x, len)
        "KAMA"          => f_kama(x, len)
        "JMA Approx"    => f_jma(x, len, jmaPhase, jmaPower)
        =>                 ta.ema(x, len)

// ─────────────────────────────────────────────────────────────────────────────
// CCI CORE
// ─────────────────────────────────────────────────────────────────────────────

cciRaw  = ta.cci(src, cciLen)
cciLine = f_smooth(cciRaw, avgLen, smoothType)
signal  = f_smooth(cciLine, sigLen, smoothType)
hist    = cciLine - signal

// Slow CCI = the trend the fast line rests on (same kernel, longer length).
ctxRaw  = ta.cci(src, ctxLen)
ctxLine = f_smooth(ctxRaw, avgLen, smoothType)

// ─────────────────────────────────────────────────────────────────────────────
// SCALE
// ─────────────────────────────────────────────────────────────────────────────

float scaleAbs = ta.highest(math.max(math.abs(cciLine), math.abs(signal)), scaleLookback)

f_scale(series float x, float sharedMax) =>
    if scaleMode == "Clamp ±200"
        math.max(math.min(x, 200.0), -200.0)
    else if scaleMode == "Adaptive ±100"
        sharedMax != 0.0 ? 100.0 * x / sharedMax : 0.0
    else
        x

cciDisp = f_scale(cciLine, scaleAbs)
sigDisp = f_scale(signal,  scaleAbs)
ctxDisp = f_scale(ctxLine, scaleAbs)

// ─────────────────────────────────────────────────────────────────────────────
// SIGNALS (on raw / unscaled values)
// ─────────────────────────────────────────────────────────────────────────────

wasOversold   = ta.lowest(cciLine,  lookbackExtreme) <= os1
wasOverbought = ta.highest(cciLine, lookbackExtreme) >= ob1

bullCross    = ta.crossover(cciLine,  signal)
bearCross    = ta.crossunder(cciLine, signal)
bullExtreme  = bullCross and (not useExtremeOnly or wasOversold)
bearExtreme  = bearCross and (not useExtremeOnly or wasOverbought)
bullZeroCross = ta.crossover(cciLine,  0.0)
bearZeroCross = ta.crossunder(cciLine, 0.0)

// Stall: CCI moves sharply over the lookback while price barely follows (momentum
// decoupled from price). Symmetric — direction comes from the situation, not a side.
float atrRef   = ta.atr(14)
float cciChg   = cciLine - cciLine[stallLen]
float priceChg = atrRef != 0.0 ? (close - close[stallLen]) / atrRef : 0.0
bool  flatPx   = math.abs(priceChg) < stallFlatATR
bool  stallBull = useStall and cciChg < -stallCciMin and flatPx   // CCI cools, price holds → absorption
bool  stallBear = useStall and cciChg >  stallCciMin and flatPx   // CCI heats, price holds → distribution
bool  stallNow  = stallBull or stallBear

// Trend context: the slow CCI is the side the fast line rests on. An extreme cross
// against the context's side of zero is counter-trend.
bool ctxBull = ctxLine > 0.0
bool ctxBear = ctxLine < 0.0
bool bearCounter = useCtx and bearExtreme and ctxBull
bool bullCounter = useCtx and bullExtreme and ctxBear

// Trend↔CCI divergence: fast and slow travel in opposite directions. The fast line
// needs a minimum slope (noise guard on low TFs); the slow line is smooth, so its
// sign alone is stable. Directional — flavor tells supported dip from weak bounce.
float fastDir = cciLine - cciLine[divLen]
float slowDir = ctxLine - ctxLine[divLen]
bool  divBull = useCtx and showDiv and fastDir < -divMin and slowDir > 0.0   // fast cools into a rising trend → supported dip
bool  divBear = useCtx and showDiv and fastDir >  divMin and slowDir < 0.0   // fast heats into a falling trend → unsupported bounce

// Cross conviction: a cross is "weak" when its move is contradicted by a flat price
// (absorbed) or runs against the trend context (counter). The cross still fires —
// only its rendering changes.
bool bearStrong = bearExtreme and not (stallBull or bearCounter)
bool bearWeak   = bearExtreme and (stallBull or bearCounter)
bool bullStrong = bullExtreme and not (stallBear or bullCounter)
bool bullWeak   = bullExtreme and (stallBear or bullCounter)

// ─────────────────────────────────────────────────────────────────────────────
// SCORE — Sentiment Bar (live extremity read) and Signal Quality (0-100 per
// cross), same weighting as Williams VIX Fix Advanced's Spike Quality, adapted
// to a single signed line instead of two independent bull/bear formulas.
// Computed on raw cciLine/ob1/os1, same convention as the signal logic above —
// scale-mode agnostic regardless of the Classic/Clamp/Adaptive display mode.
// ─────────────────────────────────────────────────────────────────────────────

float sentBullPct  = ob1 != 0.0 ? math.max(0.0, cciLine) / ob1 * 100.0 : 0.0
float sentBearPct  = os1 != 0.0 ? math.max(0.0, -cciLine) / math.abs(os1) * 100.0 : 0.0
float sentScore    = math.max(-100.0, math.min(100.0, sentBullPct - sentBearPct))
float sentAbsScore = math.abs(sentScore)

// Depth = penetration beyond the zone in units of the zone-to-zero distance,
// capped at 1 so it contributes at most its documented 50 points
float bullDepth   = os1 != 0.0 ? math.max(0.0, math.min(1.0, (os1 - ta.lowest(cciLine, lookbackExtreme)) / math.abs(os1))) : 0.0
float bearDepth   = ob1 != 0.0 ? math.max(0.0, math.min(1.0, (ta.highest(cciLine, lookbackExtreme) - ob1) / math.abs(ob1))) : 0.0
float bullQuality = math.min(100.0, bullDepth * 50.0 + (ctxBull ? 25.0 : 0.0) + (not stallBear ? 25.0 : 0.0))
float bearQuality = math.min(100.0, bearDepth * 50.0 + (ctxBear ? 25.0 : 0.0) + (not stallBull ? 25.0 : 0.0))

// ─────────────────────────────────────────────────────────────────────────────
// COLORS
// ─────────────────────────────────────────────────────────────────────────────

color lineCol  = color.from_gradient(cciDisp, os1, ob1, colBull, colBear)
color lineCol2 = color.from_gradient(sigDisp, os1, ob1, color.new(colBull, 40), color.new(colBear, 40))

// Trend context line = long/short regime color (green above zero, red below).
color ctxCol = ctxLine >= 0.0 ? color.new(colLong, 55) : color.new(colShort, 55)

// Histogram = long/short momentum; rising/falling drives full vs faded opacity.
histRising = hist >= hist[1]
histColor  = hist >= 0.0
     ? (histRising     ? colLong                     : color.new(colLong, 55))
     : (not histRising ? colShort                    : color.new(colShort, 55))

// ─────────────────────────────────────────────────────────────────────────────
// HLINES + ZONE FILLS
// ─────────────────────────────────────────────────────────────────────────────

hline(0, "Zero", color=color.new(color.gray, 60), linestyle=hline.style_dotted, linewidth=1)
hOB2 = hline(ob2, "OB 2", color=color.new(color.red, 45), linestyle=hline.style_solid,  linewidth=1)
hOB1 = hline(ob1, "OB 1", color=color.new(color.red, 65), linestyle=hline.style_dashed, linewidth=1)
hOS1 = hline(os1, "OS 1", color=color.new(#00bcd4, 65),   linestyle=hline.style_dashed, linewidth=1)
hOS2 = hline(os2, "OS 2", color=color.new(#00bcd4, 45),   linestyle=hline.style_solid,  linewidth=1)

fill(hOB1, hOB2, color=showZoneFill ? colZoneOB : na, title="OB Zone")
fill(hOS2, hOS1, color=showZoneFill ? colZoneOS : na, title="OS Zone")

// ─────────────────────────────────────────────────────────────────────────────
// PLOTS
// ─────────────────────────────────────────────────────────────────────────────

color histColorFinal = stallNow ? color.new(histColor, 78) : histColor
plot(showHist ? hist : na, "Histogram", style=plot.style_columns, color=histColorFinal)

pZero = plot(0.0, display=display.none)
pCtx  = plot(useCtx ? ctxDisp : na, "Trend Context", color=ctxCol, linewidth=2)
pSig  = plot(sigDisp,  "CCI Signal", color=lineCol2, linewidth=1)
pCCI  = plot(cciDisp,  "CCI",        color=lineCol,  linewidth=2)

// Divergence wedge: lights up only when fast CCI and trend context disagree.
fill(pCCI, pCtx, color=divBull ? color.new(colLong, 80) : divBear ? color.new(colShort, 80) : na,
     title="Trend Divergence")

fill(pCCI, pZero, ob1,  0.0, color.new(colBear, 78), color.new(colBear, 100),
     title="Bear Shadow", display=showShadow ? display.all : display.none)
fill(pCCI, pZero, 0.0, os1,  color.new(colBull, 100), color.new(colBull, 78),
     title="Bull Shadow", display=showShadow ? display.all : display.none)

fill(pCCI, pSig,
     color=showFill ? (cciDisp >= sigDisp ? color.new(colBull, 88) : color.new(colBear, 88)) : na,
     title="CCI Fill")

// ─────────────────────────────────────────────────────────────────────────────
// SIGNAL MARKERS
// ─────────────────────────────────────────────────────────────────────────────

plotshape(showSignals and bullStrong, "Bull Extreme",
     style=shape.triangleup, location=location.bottom,
     color=colBull, size=size.small)

plotshape(showSignals and bullWeak, "Bull Extreme (absorbed)",
     style=shape.triangleup, location=location.bottom,
     color=color.new(colBull, 65), size=size.tiny)

plotshape(showSignals and bearStrong, "Bear Extreme",
     style=shape.triangledown, location=location.top,
     color=colBear, size=size.small)

plotshape(showSignals and bearWeak, "Bear Extreme (absorbed)",
     style=shape.triangledown, location=location.top,
     color=color.new(colBear, 65), size=size.tiny)

plotshape(showSignals and showZeroCross and bullZeroCross ? cciDisp : na, "Bull Zero",
     style=shape.circle, location=location.absolute,
     color=color.new(colBull, 20), size=size.tiny)

plotshape(showSignals and showZeroCross and bearZeroCross ? cciDisp : na, "Bear Zero",
     style=shape.circle, location=location.absolute,
     color=color.new(colBear, 20), size=size.tiny)

// ─────────────────────────────────────────────────────────────────────────────
// SCORE DISPLAY — Sentiment Bar (always-on read of current extremity) and
// per-cross Quality labels (why a Strong/Weak marker was graded that way).
// Labels anchor to cciDisp (the scaled display value) so they land at the
// right screen height regardless of scaleMode; the score itself is computed
// on raw cciLine above.
// ─────────────────────────────────────────────────────────────────────────────

f_scoreColor(score, absS) =>
    base = score > 0 ? colBear : colBull
    color result = na
    if absS < 15
        result := color.new(color.gray, 40)
    else if absS >= 80
        result := color.new(base, 10)
    else if absS >= 60
        result := color.new(base, 30)
    else if absS >= 40
        result := color.new(base, 50)
    else
        result := color.new(base, 70)
    result

int    scoreBarSegments = 8
int    scoreFilled      = int(math.round(sentAbsScore / 100.0 * scoreBarSegments))
string scoreBarStr      = str.repeat("■", scoreFilled) + str.repeat("·", scoreBarSegments - scoreFilled)
string scoreSignStr     = sentScore > 0 ? "+" : ""
string sentTxt          = scoreSignStr + str.tostring(sentScore, "#") + "  " + scoreBarStr
color  sentColor        = f_scoreColor(sentScore, sentAbsScore)

var label sentLabel = na
if showSentiment and barstate.islast
    label.delete(sentLabel)
    sentLabel := label.new(bar_index + 3, 0.0, sentTxt,
         xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left,
         color=sentColor, textcolor=color.white, size=size.normal,
         tooltip="How far CCI sits inside its own OB/OS zone: 100×CCI/Overbought1 when bullish, -100×CCI/Oversold1 when bearish, clamped to ±100. |score| < 15 reads as balanced.")
else if not showSentiment and barstate.islast
    label.delete(sentLabel)

if showQuality and bullExtreme
    label.new(bar_index, cciDisp, str.tostring(bullQuality, "#"),
         style=label.style_label_up, color=bullStrong ? colBull : color.new(colBull, 65), textcolor=color.white, size=size.tiny,
         tooltip="Bull Signal Quality " + str.tostring(bullQuality, "#") + "/100 — OB/OS-zone depth 50% + context agreement 25% + stall-free 25%.")
if showQuality and bearExtreme
    label.new(bar_index, cciDisp, str.tostring(bearQuality, "#"),
         style=label.style_label_down, color=bearStrong ? colBear : color.new(colBear, 65), textcolor=color.white, size=size.tiny,
         tooltip="Bear Signal Quality " + str.tostring(bearQuality, "#") + "/100 — OB/OS-zone depth 50% + context agreement 25% + stall-free 25%.")

// ─────────────────────────────────────────────────────────────────────────────
// ALERTS
// ─────────────────────────────────────────────────────────────────────────────

bool alertsOnBarClose = input.bool(true, "Alerts only on bar close (confirmed)", group="11 · Alerts")
bool alertOk = not alertsOnBarClose or barstate.isconfirmed

alertcondition(alertOk and bullExtreme,   "CCI Bull Signal",      "CCIA · BULL CROSS OVERSOLD · {{ticker}} {{interval}}")
alertcondition(alertOk and bearExtreme,   "CCI Bear Signal",      "CCIA · BEAR CROSS OVERBOUGHT · {{ticker}} {{interval}}")
alertcondition(alertOk and bullZeroCross, "CCI Cross Above Zero", "CCIA · CROSS ABOVE ZERO · {{ticker}} {{interval}}")
alertcondition(alertOk and bearZeroCross, "CCI Cross Below Zero", "CCIA · CROSS BELOW ZERO · {{ticker}} {{interval}}")

Overview

CCI Advanced [WavesUnchained] calculates a smoothed Commodity Channel Index (CCI) paired with a signal line, offering multiple smoothing algorithms like EMA, SuperSmoother, KAMA, and JMA. Traders can select between classic unbounded scaling, clamped limits, or adaptive rescaling. The indicator features a four-state histogram, zero-line cross signals, overbought and oversold zone fills, and stall filters to identify weak momentum movements relative to price.

Details

Published by

casoon on GitHub

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pine-scriptpinescripttechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourcehlc3src
CCI Lengthint20cciLen
Average Lengthint3avgLen
Signal Lengthint9sigLen
TypestringEMAsmoothType
JMA Phaseint50jmaPhase
JMA Powerfloat2.0jmaPower
ModestringClassicscaleMode
Adaptive Lookbackint200scaleLookback
Overbought 1float100ob1
Overbought 2float200ob2
Oversold 1float-100os1
Show all 39 settings
SettingTypeDefaultVariable
Oversold 2float-200os2
Extreme Signals: require OB/OS zonebooltrueuseExtremeOnly
OB/OS Lookback (bars)int5lookbackExtreme
Show Zero-Line Cross MarkersbooltrueshowZeroCross
Bull (CCI level)color#00bcd4colBull
Bear (CCI level)color#f06292colBear
Long (trend / momentum)color#00c853colLong
Short (trend / momentum)color#d50000colShort
OB Zone Fillcolorcolor.new(#f06292, 90)colZoneOB
OS Zone Fillcolorcolor.new(#00bcd4, 90)colZoneOS
Shadow Fill (CCI vs Zero)booltrueshowShadow
Fill CCI / SignalbooltrueshowFill
Fill OB / OS ZonesbooltrueshowZoneFill
Show HistogrambooltrueshowHist
Show Signal MarkersbooltrueshowSignals
Detect Stall (CCI moves, price holds)booltrueuseStall
Stall Lookback (bars)int5stallLen
Max Price Move (ATR)float0.5stallFlatATR
Min CCI Movefloat40stallCciMin
Show Trend Context LinebooltrueuseCtx
Trend CCI Lengthint100ctxLen
Highlight Trend ↔ CCI DivergencebooltrueshowDiv
Divergence Slope Lookbackint4divLen
Min Fast Slopefloat25divMin
Show Sentiment BarbooltrueshowSentiment
Show Signal Quality LabelsboolfalseshowQuality
Alerts only on bar close (confirmed)booltruealertsOnBarClose
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Asymmetrical RSI

by everget
947 stars

Asymmetrical RSI is an indicator that computes a custom relative strength index from the rate of change of a user-selected source. It plots the resulting ARSI line in a separate pane with color coding that turns green above the overbought level and red below t

Indicator v4 Oscillators & momentum
Updated 12 days ago · GPL-3.0 GitHub repository of Asymmetrical RSI

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop
261 stars

This indicator demonstrates an experimental graph-style scatter visualization within a separate pane using Pine Script arrays. It tracks two features across recent bars: the single-bar price change and a scaled 14-period Relative Strength Index. Values are loa

Indicator v4 Oscillators & momentum
Updated 4 years ago · None stated GitHub repository of Example: Graph Style - 4th Dimension RSI
228 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers