1. Strategy Overview

This is a popular strategy originating from YouTube. Original video link: I Backtested The Best CCI indicator Strategy (Full Tutorial). The CCI indicator serves two purposes. A long‑period CCI identifies market direction, while a short‑period CCI detects overbought and oversold conditions. The original creator built this strategy leveraging these two characteristics of CCI, combining long‑period and short‑period CCI settings. The original author also ran parameter tuning and backtest, verifying that this strategy concept works on specific instruments. In this article I will walk through this strategy and build a compatible Expert Advisor (EA) for MT5.

2. Full Trading Rules

Core Indicators

  • CCI(110): 110‑period CCI for trend direction detection. Readings above 80 signal an uptrend, readings below ‑80 signal a downtrend.
  • CCI(5): 5‑period CCI used to spot price overbought and oversold conditions. Readings above 100 count as overbought, readings below ‑100 count as oversold.
  • ATR: Dynamically calculates stop‑loss levels.

Basic Rules

  • Timeframe: All timeframes
  • Assets: Forex, stocks, futures, crypto and others

Entry Rules

Long entry

  1. CCI(110) sits above 80
  2. CCI(5) drops below ‑100

Long Setup Example

Short entry

  1. CCI(110) sits below ‑80
  2. CCI(5) rises above 100

Short Setup Example

Exit Rules

Long Exit

  • SL: Entry price minus fixed ATR multiple
  • TP: Stop‑loss distance multiplied by 2

Short Exit

  • SL: Entry price plus fixed ATR multiple
  • TP: Stop‑loss distance multiplied by 2

Edge & limitations

This strategy uses very simple indicators. Definitions for trend and trade triggers are clear and easy to understand.

However, the backtest shown in the original video was optimized for AVAX/USDT over a specific time window. The reported backtest performance therefore carries risk of overfitting. Optimized parameters from that video cannot be directly applied to other instruments.

On the other hand, the original strategy opens trades immediately once CCI(5) enters the overbought or oversold zone. It can deliver better entry prices when the trend is clear. However, it may trigger consecutive stop‑loss hits during sharp pullbacks. For further improvements to this strategy, bar‑pattern confirmation can be added to filter out false signals.

3.EA implementation

Core logic

I coded this Expert Advisor (EA) following the original strategy logic. Signal evaluation only triggers on bar close, and only one single order is allowed at any time. The long‑period CCI confirms trend direction, while the short‑period CCI must enter overbought or oversold zone. Once both conditions are satisfied, the EA opens trades after bar close.

Regarding money‑management rules, the original strategy does not specify an optimal ATR setting. For consistent rules, stop‑loss is set using 2× ATR.

Long entry Core code snippet:

1
2
3
4
5
6
7
8
9
10
11
12
13
if(trendCCI_val > TrendCCI_ThresholdHigh) //Long‑period CCI above upper threshold
{
//...
allowLong = true;
}
//...
bool signalLong = (oscCCI_val <= OscCCI_ThresholdOversold); //Short‑period CCI enters oversold zone
//==== Long entry logic ====
if(signalLong && allowLong)
{
//Open long position
}

Parameter Settings

Parameter Default Value Description
MagicNumber 12345 EA magic number used to identify orders belonging to this EA
TrendCCI_Period 110 Long‑period CCI for trend detection
OscCCI_Period 5 Short‑period CCI for overbought / oversold detection
ATR_Period 14 Period setting for the ATR indicator
TradeLots 0.1 Trading lot size
ATR_SL_Multi 2.0 ATR multiplier used for stop‑loss calculation
TP_Of_SL_Ratio 2.0 Take‑profit expressed as multiple of stop‑loss distance
TrendCCI_ThresholdHigh 80.0 Long‑period CCI upper threshold (only long above this level)
TrendCCI_ThresholdLow -80.0 Long‑period CCI lower threshold (only short below this level)
OscCCI_ThresholdOversold -100.0 Oversold threshold level for short‑period CCI
OscCCI_ThresholdOverbought 100.0 Overbought threshold level for short‑period CCI

EA Source Code / Download

Click to download

5. Limitations & Disclaimer

No backtest / forward‑test results provided. Users must verify robustness via personal backtest and demo forward‑testing before live usage.

Not financial advice. Forex trading involves substantial risk.