OPEN-SOURCE SCRIPT
SuperTrend Regime Confluence

📊 SUPERTREND REGIME CONFLUENCE
A trend-following strategy combining a volatility-adaptive SuperTrend with a
market-regime classifier and a five-factor confluence filter.
The three components aren't stacked arbitrarily. Each one fixes a specific,
well-known weakness of the others, which is why they're combined into a single
tool rather than used separately.
🧩 WHY THESE COMPONENTS ARE COMBINED
A standard SuperTrend has two weaknesses:
- Fixed ATR multiplier: too tight in volatile markets (premature flips), too
wide in quiet trends.
- It flips on every crossover regardless of conditions, causing whipsaws in
sideways markets.
This strategy addresses both:
1️⃣ Regime detection adapts the band.
An ADX plus ATR-ratio classifier labels each bar Trending, Volatile, or Ranging.
In Volatile conditions the multiplier widens (fewer false flips during
expansion); in Ranging conditions it tightens. The band reacts to conditions
instead of using one fixed setting.
2️⃣ The regime filter removes the worst environment.
Entries during the Ranging regime (where trend-following bleeds) can be skipped
entirely.
3️⃣ The confluence score gates each flip.
Rather than trading every SuperTrend flip, each candidate entry is scored 0 to
100. Only flips clearing a minimum score are taken.
Together: the classifier makes the band adaptive, the regime filter removes the
setting where the signal fails, and the score removes the weakest signals. Each
piece compensates for a limitation of the SuperTrend it's built on.
🧮 THE CONFLUENCE SCORE (rules-based, not machine learning)
A plain weighted sum of five factors, each contributing fixed points. It is
fully deterministic and documented in the code. No model, no training, no black
box:
- Volume surge (0 to 20): entry-bar volume vs its moving average
- Displacement (0 to 25): distance price moved beyond the band, in ATR units
- Trend alignment (0 to 20): signal direction vs a longer EMA
- Regime quality (0 to 15): more points in a clean Trending regime
- Prior distance (0 to 20): how far price held from the band before the flip
The sum (capped at 100) must exceed the Min Signal Score input to trigger entry.
🛡️ RISK MANAGEMENT AND SIZING
- Risk-based sizing: each position is sized so a stop-out risks a fixed percent
of equity.
- Capped at 90% of equity: no leverage, always a margin buffer (no liquidations).
- Selectable stops (ATR, Percent, or SuperTrend flip) and take-profits
(Risk:Reward, Percent, or None).
- Optional EMA filter, volume filter, entry cooldown, and long/short toggles.
- Default risk sits within TradingView's suggested 5 to 10 percent band. Lower it
for a more conservative profile.
⚙️ DEFAULT SETTINGS (as shown)
BTCUSDT, 4H, 6% risk per trade.
ATR length 10, base multiplier 3, regime lookback 40, ADX 14, ADX threshold 20.
Trend EMA 50, min signal score 65, ATR stop 6x, risk:reward 2.5, cooldown 5 bars.
Commission 0.06%, slippage 2 ticks.
Backtest shown: Jan 2020 to Sep 2026. Return +824%, max drawdown 24.55%, profit
factor 1.80, win rate 46.4%, 168 trades.
⚠️ NOTES ON USE
This is a trend-following system, so it performs best on instruments that trend
and expand in volatility. Expect drawdowns and losing streaks during extended
sideways periods, which is inherent to the approach.
Results shown are a historical backtest on a single instrument and do not
indicate future performance. Test on your own instrument, timeframe, and cost
assumptions before use. This is not financial advice.
A trend-following strategy combining a volatility-adaptive SuperTrend with a
market-regime classifier and a five-factor confluence filter.
The three components aren't stacked arbitrarily. Each one fixes a specific,
well-known weakness of the others, which is why they're combined into a single
tool rather than used separately.
🧩 WHY THESE COMPONENTS ARE COMBINED
A standard SuperTrend has two weaknesses:
- Fixed ATR multiplier: too tight in volatile markets (premature flips), too
wide in quiet trends.
- It flips on every crossover regardless of conditions, causing whipsaws in
sideways markets.
This strategy addresses both:
1️⃣ Regime detection adapts the band.
An ADX plus ATR-ratio classifier labels each bar Trending, Volatile, or Ranging.
In Volatile conditions the multiplier widens (fewer false flips during
expansion); in Ranging conditions it tightens. The band reacts to conditions
instead of using one fixed setting.
2️⃣ The regime filter removes the worst environment.
Entries during the Ranging regime (where trend-following bleeds) can be skipped
entirely.
3️⃣ The confluence score gates each flip.
Rather than trading every SuperTrend flip, each candidate entry is scored 0 to
100. Only flips clearing a minimum score are taken.
Together: the classifier makes the band adaptive, the regime filter removes the
setting where the signal fails, and the score removes the weakest signals. Each
piece compensates for a limitation of the SuperTrend it's built on.
🧮 THE CONFLUENCE SCORE (rules-based, not machine learning)
A plain weighted sum of five factors, each contributing fixed points. It is
fully deterministic and documented in the code. No model, no training, no black
box:
- Volume surge (0 to 20): entry-bar volume vs its moving average
- Displacement (0 to 25): distance price moved beyond the band, in ATR units
- Trend alignment (0 to 20): signal direction vs a longer EMA
- Regime quality (0 to 15): more points in a clean Trending regime
- Prior distance (0 to 20): how far price held from the band before the flip
The sum (capped at 100) must exceed the Min Signal Score input to trigger entry.
🛡️ RISK MANAGEMENT AND SIZING
- Risk-based sizing: each position is sized so a stop-out risks a fixed percent
of equity.
- Capped at 90% of equity: no leverage, always a margin buffer (no liquidations).
- Selectable stops (ATR, Percent, or SuperTrend flip) and take-profits
(Risk:Reward, Percent, or None).
- Optional EMA filter, volume filter, entry cooldown, and long/short toggles.
- Default risk sits within TradingView's suggested 5 to 10 percent band. Lower it
for a more conservative profile.
⚙️ DEFAULT SETTINGS (as shown)
BTCUSDT, 4H, 6% risk per trade.
ATR length 10, base multiplier 3, regime lookback 40, ADX 14, ADX threshold 20.
Trend EMA 50, min signal score 65, ATR stop 6x, risk:reward 2.5, cooldown 5 bars.
Commission 0.06%, slippage 2 ticks.
Backtest shown: Jan 2020 to Sep 2026. Return +824%, max drawdown 24.55%, profit
factor 1.80, win rate 46.4%, 168 trades.
⚠️ NOTES ON USE
This is a trend-following system, so it performs best on instruments that trend
and expand in volatility. Expect drawdowns and losing streaks during extended
sideways periods, which is inherent to the approach.
Results shown are a historical backtest on a single instrument and do not
indicate future performance. Test on your own instrument, timeframe, and cost
assumptions before use. This is not financial advice.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.