OPEN-SOURCE SCRIPT

Commodity Channel Index - CCI

59
🎯 Overview
This is an enhanced Commodity Channel Index (CCI) indicator that transforms the traditional CCI into a centerline-focused momentum tool with moving average smoothing and comprehensive visual enhancements. Unlike standard CCI which uses ±100 levels, this version focuses on the 50-level centerline for clearer trend direction signals.

🧩 Core Components
1. ⚙️ Technical Foundation
📊 Primary Calculation: Uses TradingView's built-in ta.cci() function

📈 Statistical Approach: Measures current price relative to statistical mean

🎯 Scale Modification: Focuses on 50 as neutral (unlike traditional ±100)

📏 Default Length: 55 periods (optimal for medium-term trends)

2. 🎛️ Configuration Parameters
📏 CCI Length: Default 55 periods

📈 CCI MA Length: 30-period moving average

🔄 MA Type: 6 options (EMA, SMA, RMA, WMA, VWMA, HMA)

🎨 Color Themes: 5 visual schemes matching your other indicators

📈 Signal Interpretation:
🟢 BULLISH: CCI > 50 (price above statistical mean)

🔴 BEARISH: CCI < 50 (price below statistical mean)

👁️ Visual Features
📉 Chart Elements:
📊 Main CCI Line:

Shows raw CCI momentum

📈 Signal Line (CCI MA):

Yellow moving average of CCI

30-period default provides smoothed trend

🎨 Fill Zones:

🟢 Upper Zone : Bullish momentum area

🔴 Lower Zone : Bearish momentum area

📋 Dashboard Display:

Content: "⬆️ Bullish" or "⬇️ Bearish" indicator

Purpose: Instant market bias assessment

⚡ Trading Applications
📈 Primary Uses:
🎯 Trend Direction Identification

CCI > 50 = Uptrend momentum

CCI < 50 = Downtrend momentum

📊 Extreme Momentum Detection

CCI > 100 = Strong bullish (traditional)

CCI < -100 = Strong bearish (traditional)

CCI near ±300 = Extreme conditions

🔄 Mean Reversion Opportunities

Useful in ranging markets

🎯 Signal Types:
📈 Trend-Following: Stay long when CCI > 50, short when < 50

🔄 Mean Reversion: Fade extreme readings (>100 or <-100)

⚡ Crossover Signals: CCI crossing 50 provides entry/exit points

🎨 Customization Options
🔄 Moving Average Types:
📉 EMA: Exponential - responsive to recent CCI changes

📊 SMA: Simple - smooths CCI equally

📈 RMA: Relative - TradingView's special MA

⚖️ WMA: Weighted - emphasizes recent CCI values

💎 VWMA: Volume-weighted - incorporates volume indirectly

🚀 HMA: Hull - reduces lag on CCI signals

🎨 Visual Themes: (Consistent with your suite)
🎨 Classic: Green/Red (traditional)

🚀 Modern: Cyan/Purple (contemporary)

💪 Robust: Amber/Deep Purple (high contrast)

🌈 Accented: Purple/Magenta (vibrant)

⚫⚪ Monochrome: Light Gray/Dark Gray (minimalist)

🔔 Alert System
🟢 LONG Alert: Triggers when CCI > 50

🔴 SHORT Alert: Triggers when CCI < 50

📧 Format: Includes ticker symbol for portfolio tracking

⚡ Key Advantages
✅ Strengths:
🎯 Clear Centerline Focus: 50-level provides unambiguous trend direction

📊 Statistical Foundation: Based on mean deviation (more robust than simple oscillators)

👁️ Extreme Zone Visualization: ±300 boundaries show momentum extremes

🔄 Versatile Application: Works for both trend-following and mean reversion

📱 Professional Suite: Consistent design with your RSI and SMI indicators

⚡ Optimal Settings:
📈 Trending Markets: 55-period CCI (default)

🔄 Ranging Markets: Shorter periods (20-30)

📊 Volatile Markets: Longer periods (80-100)

📱 Day Trading: 20-period with EMA smoothing

🏆 Unique Features:
Statistical Rigor: Based on mean deviation (not just price differences)

Wide Range: ±300 scale captures extreme movements

Centerline Focus: Clear binary trend signals

Visual Harmony: Consistent with your indicator suite design

This CCI indicator provides a statistically robust approach to trend identification while maintaining the visual consistency and user-friendly design of your trading suite! 📊✨

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.