OPEN-SOURCE SCRIPT

V/S Dual CCI Strategy Signal

492
Dual CCI Strategy Signal — TradingView Indicator Description (English)
Overview

This indicator generates buy/sell signals based on two independent CCI (Commodity Channel Index) indicators with customizable timeframes, smoothing methods, and filters.

The primary signal comes from CCI1 crossing its smoothed moving average (MA). Additional filters using overbought/oversold zones (for both CCI1 and CCI2) help reduce false signals and allow trading only when a recent momentum extreme occurred.
How it works

CCI1 (primary) – calculates CCI on its own timeframe (or current chart timeframe).

MA1 – smoothed version of CCI1 (SMA, EMA, WMA, etc.).

Signal – a crossover of CCI1 and MA1 gives a Long signal; a crossunder gives a Short signal.

Filters (optional):

CCI1 zone filter – requires that CCI1 touched the oversold zone (for Long) or overbought zone (for Short) within the last N bars (lookback).

CCI2 MA neutral zone filter – prevents trading when CCI2's smoothed MA is inside a defined neutral range (e.g., -100 to +100).

CCI2 zone filter – requires that CCI2 (not its MA) touched oversold/overbought levels within the last N bars.

All filters can be individually enabled/disabled. When disabled, the signal relies only on the CCI1/MA1 crossover.
Input Parameters
CCI1 (Primary)

Timeframe – timeframe for CCI1 calculation (leave empty to use chart timeframe).

Source – price source (default: hlc3).

Length – CCI period (default: 20).

MA Type – smoothing type for CCI1 (None, SMA, SMA + Bollinger Bands, EMA, SMMA (RMA), WMA, VWMA).

MA Length – length of the smoothing MA (default: 14).

BB StdDev – standard deviation multiplier for Bollinger Bands (if selected).

CCI2 (Higher TF / confirmation)

Timeframe – timeframe for CCI2 (e.g., 1D, 4H).

Source, Length, MA Type, MA Length, BB StdDev – same as for CCI1.

Filters

CCI1 zone filter

Lookback – number of bars (in CCI1's timeframe) to check for overbought/oversold touches.

Overbought / Oversold – levels (default: +100 / -100).

CCI2 MA neutral zone filter

Neutral Low / High – range where CCI2's MA blocks signals (default: -100 to +100).

CCI2 zone filter

Lookback – same as for CCI1 but applied to CCI2.

Overbought / Oversold – levels for CCI2 (default: +100 / -100).

Each filter has an enable checkbox.
Visual Output

Green triangle (L) – Long signal (CCI1 crosses above its MA and all enabled filters are satisfied).

Red triangle (S) – Short signal (CCI1 crosses below its MA and all enabled filters are satisfied).

Alerts – built-in alert conditions for Long and Short signals.

Note: This version does not plot CCI lines or bands to keep the chart clean. Only signals appear as arrows on the price chart.
Usage Tips

Set different timeframes – use CCI1 on a lower (entry) timeframe and CCI2 on a higher (trend) timeframe.

Adjust filter levels – if signals are too frequent, increase overbought/oversold values (e.g., +150/-150) or lengthen lookback.

Disable filters – to see pure CCI1/MA crossovers, uncheck all filter boxes.

Combine with price action – signals work best when confirmed by support/resistance or trend lines.

Example Configuration (from your screenshots)

CCI1: 1H timeframe, Length 9, MA Type SMA, MA Length 2

CCI2: 2H timeframe, Length 20, MA Type SMA

Filters: CCI1 zone ±180, lookback 50; CCI2 MA neutral zone -50..+50; CCI2 zone ±180, lookback 260

This gives rare, high‑confidence signals.
Alert Conditions

Dual CCI Long – triggered on a valid Long signal.

Dual CCI Short – triggered on a valid Short signal.

Happy trading!
Pine Script code included – copy, modify, and use at your own discretion.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.