OPEN-SOURCE SCRIPT

Enhanced CCI with Trend Filters

This indicator combines the power of the Commodity Channel Index (CCI) with adaptive trend filters and divergence detection to identify high-probability trading opportunities. It's designed to reduce false signals by incorporating trend direction and divergence confirmation.

🔍 How It Works:

1. Trend Detection:
- Uses an adaptive Simple Moving Average (SMA) that automatically adjusts between daily and weekly timeframes
- Daily mode: Default 200 SMA for longer-term trend
- Weekly mode: Default 40 SMA for broader market perspective
- Trend direction is determined by comparing current SMA value to its previous value

2. CCI Component:
- Traditional CCI calculation with customizable length (default: 20)
- Adjustable overbought (default: +100) and oversold (default: -100) levels
- Color-coded CCI line for quick visual reference:
* Green: Overbought and rising
* Red: Oversold and falling
* Gray: Neutral zone

3. Signal Generation:
- Buy Signal (Green Background):
* CCI crosses above oversold level AND
* Main trend is confirmed bullish (rising SMA)
- Sell Signal (Red Background):
* CCI crosses below overbought level AND
* Main trend is confirmed bearish (falling SMA)

4. Divergence Detection:
- Automatically identifies bullish and bearish divergences
- Bullish Divergence: Price makes lower low while CCI makes higher low
- Bearish Divergence: Price makes higher high while CCI makes lower high
- Visualized with distinct markers on the CCI line
- Can be used to set up alerts for divergence confirmations

⚙️ Customization Options:
- CCI calculation length and price source
- Overbought/Oversold levels
- SMA lengths for daily and weekly modes
- Divergence lookback period
- Signal colors and visualization settings

🔔 Alert Capabilities:
- Set alerts for CCI crossovers of overbought/oversold levels
- Create divergence detection alerts
- Configure trend change notifications
- Combine multiple conditions for complex alert strategies

💡 Trading Tips:
- Combine divergence signals with trend direction for better accuracy
- Wait for signal confirmation before entering trades
- Use additional indicators or price action for exit decisions

This indicator helps traders identify potential trend reversals while keeping them aligned with the main market trend. Perfect for both trend following and counter-trend strategies when used appropriately.

Tags: CCI, trend following, divergence, momentum, signals, SMA, multi-timeframe, technical analysis, trend filter, oversold, overbought

Note: Past performance does not guarantee future results. Always combine with proper risk management.
Moving AveragesmultitimeframeTrend Analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


Aussi sur:

Clause de non-responsabilité