OPEN-SOURCE SCRIPT

SHK CCI+RSI Merged | Dual Divergence | Pine v6

373
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔷 SHK CCI+RSI MERGED — CLEAN 2-LINE OSCILLATOR
Built with Pine Script v6
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Why run two oscillators when one can do more?

This indicator intelligently merges CCI and RSI into
a single blended line — reducing chart noise while
combining the strengths of both indicators into
one clean, actionable signal.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📐 THE BLEND — HOW IT WORKS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Step 1 — RSI is normalized to the CCI scale:

RSI 50 → 0 (zero / neutral line)
RSI 70 → +100 (overbought boundary)
RSI 30 → -100 (oversold boundary)

Step 2 — Both are averaged:

Blended = ( CCI + Normalized RSI ) / 2

The ±100 levels now act as the unified overbought
and oversold zone for BOTH CCI and RSI together.

When RSI is disabled → falls back to pure CCI.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 WHAT YOU SEE — JUST 2 LINES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

● LINE 1 — CCI+RSI Blended (thick line)

Color reflects momentum state in real time:

🟢 Bright Green → above MA + above zero (strong bull)
🟢 Faded Green → above MA + below zero (weak bull)
🔴 Bright Red → below MA + below zero (strong bear)
🔴 Faded Red → below MA + above zero (weak bear)

● LINE 2 — Signal MA (yellow line)

EMA / SMA / WMA of the blended line.
Acts as the dynamic trend filter and crossover trigger.

● HISTOGRAM — Strength Bars

Plotted behind both lines. Color intensity shows
how deep into overbought / oversold territory
the blended line has moved.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📉 DUAL DIVERGENCE DETECTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Two independent engines detect divergences simultaneously:

🟩 CCI+RSI Divergence (solid lines)
Blended oscillator pivots compared to price pivots:
• Lime solid line + "Bull Div" → Bullish divergence
• Red solid line + "Bear Div" → Bearish divergence

🟦 RSI-Only Divergence (dashed lines)
Raw RSI pivots detected, drawn at normalized scale:
• Aqua dashed + "RSI Bull Div" → RSI bullish divergence
• Orange dashed + "RSI Bear Div" → RSI bearish divergence

Lookback and threshold are independently adjustable
for both engines — tune to your trading style.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ ZERO LINE CROSS MARKERS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔼 Green triangle (bottom) → blended crossed above 0
🔽 Red triangle (top) → blended crossed below 0

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎨 EXTREME ZONE BACKGROUND
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Background shading activates at strong momentum zones:

🟢 Green shade → blended > +100 and above MA
🔴 Red shade → blended < -100 and below MA

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔔 ALERTS — 14 CONDITIONS READY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✅ Strong Bullish (blended > +100 & above MA)
✅ Strong Bearish (blended < -100 & below MA)
✅ Zero cross — bullish
✅ Zero cross — bearish
✅ Blended crossed above +100
✅ Blended crossed below -100
✅ Overbought zone entry
✅ Oversold zone entry
✅ Exit overbought zone
✅ Exit oversold zone
✅ RSI crossed overbought level
✅ RSI crossed oversold level
✅ RSI crossed above midline (50)
✅ RSI crossed below midline (50)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ FULL SETTINGS REFERENCE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

CCI Settings
├─ Length (default: 20)
├─ Source (default: HLC3)
├─ Signal MA Type (EMA / SMA / WMA)
└─ Signal MA Length (default: 14)

CCI Levels
├─ Overbought (default: +100)
├─ Oversold (default: -100)
├─ Upper Level (default: +100)
└─ Lower Level (default: -100)

RSI Settings
├─ Enable RSI blend (toggle on/off)
├─ RSI Length (default: 14)
├─ RSI Source (default: Close)
├─ RSI Overbought (default: 70)
└─ RSI Oversold (default: 30)

Features (each individually toggleable)
├─ Show CCI+RSI Divergences
├─ Show RSI-Only Divergences
├─ Show Trend Strength Bars
├─ Show Zero Line Cross Markers
└─ Highlight Extreme Zone Background

Divergence Settings
├─ Lookback bars (1–20, default: 5)
├─ CCI Divergence Threshold (default: 10)
└─ RSI Divergence Threshold (default: 3)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 BEST USED WITH
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

• Support / Resistance levels on price chart
• VWAP or Volume Profile for zone confluence
• Higher timeframe trend bias
• Supply & Demand or Order Block frameworks
• Works on all markets and all timeframes

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ DISCLAIMER
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This script is published for EDUCATIONAL and
INFORMATIONAL purposes only.

❌ NOT financial advice.
❌ NOT a buy or sell recommendation.
❌ Past performance does NOT guarantee future results.

Trading stocks, futures, forex, commodities and
cryptocurrencies involves SUBSTANTIAL RISK OF LOSS
and is not suitable for all investors or traders.

The author — SHK — is NOT responsible for any
trading losses or financial damages resulting from
the use or misuse of this indicator.

All trading decisions are SOLELY YOUR RESPONSIBILITY.
You agree to use this tool entirely at YOUR OWN RISK.

Consult a qualified financial advisor before making
any investment or trading decisions.

By using this indicator you fully accept all risks
and release the author from any and all liability.

📌 TRADE SMART. MANAGE YOUR RISK. PROTECT YOUR CAPITAL.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.