Indicator · Pine Script v6 · On the chart

SMC Confluence Hub

by skipp-dev· code credited to preuss_steffen

SMC Confluence Hub aggregates Smart Money Concept zone states linked from external scripts with internal technical analysis.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code239
Settings17inputs
LicenceNone statedfile: MPL-2.0
Last update2 days ago26 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

239 lines of Pine Script v6 from SMC_Confluence_Hub.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

SMC_Confluence_Hub.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © preuss_steffen

//@version=6

// ────────────────────────────────────────────────────────────────
// SMC Confluence Hub v1
//
// Aggregates SMC zone lifecycle (via BUS) with built-in trend,
// momentum, and mean-reversion signals into a single traffic-light
// confluence score. One chart, one glance.
//
// Product scope: long-dip specialist — scores bullish setups only.
//   Short-parity scoring requires a separate confluence track.
//
// Requirements:
//   - SMC Long-Dip Suite must be on the same chart with its Chart Link rows connected
//   - No additional indicators required — trend/momentum computed internally
// ────────────────────────────────────────────────────────────────

import preuss_steffen/smc_micro_profiles_generated/569 as mp

indicator("SMC Confluence Hub", overlay = true)

// ═══════════════════════════════════════════════════════════════
//  1. INPUTS
// ═══════════════════════════════════════════════════════════════

var string g_display = "1. Display"
show_table   = input.bool(true, "Show Confluence Panel",  group = g_display)
show_bg      = input.bool(true, "Highlight Confluence BG", group = g_display, tooltip = "Tint the chart background when confluence is high.")

var string g_alerts = "6. Alerts"
barCloseOnly = input.bool(true, "Alerts nur am Bar-Close", group = g_alerts, tooltip = "Wenn aktiv, feuern Alerts nur auf bestätigten (geschlossenen) Bars. Verhindert Repaint/Flicker während der laufenden Bar.")

var string g_bus = "2. Chart Link - SMC Long-Dip Suite"
// Declared in the Suite's BUS plot() order. TradingView lists a source study's
// outputs in that plot order, so matching it here means each row's dropdown pick
// moves strictly downwards while binding — no scrolling back up.
src_schema     = input.source(close, "BUS SchemaVersion", group = g_bus, display = display.none, tooltip = "Bind to the SMC Long-Dip Suite hidden BUS outputs. The rows are listed in the same order as the Suite outputs in the dropdown, so you can bind them top to bottom.")
src_armed      = input.source(close, "BUS Armed",         group = g_bus, display = display.none)
src_trigger    = input.source(close, "BUS Trigger",       group = g_bus, display = display.none)
src_invalid    = input.source(close, "BUS Invalidation",  group = g_bus, display = display.none)
src_quality    = input.source(close, "BUS QualityScore",  group = g_bus, display = display.none)
src_state_code = input.source(close, "BUS StateCode",     group = g_bus, display = display.none)

var string g_trend = "3. Trend Parameters"
ema_fast_len = input.int(21, "EMA Fast", minval = 5,  group = g_trend)
ema_slow_len = input.int(55, "EMA Slow", minval = 10, group = g_trend)

var string g_momentum = "4. Momentum Parameters"
rsi_len      = input.int(14, "RSI Length",  minval = 5,  group = g_momentum)
macd_fast    = input.int(12, "MACD Fast",   minval = 5,  group = g_momentum)
macd_slow    = input.int(26, "MACD Slow",   minval = 10, group = g_momentum)
macd_signal  = input.int(9,  "MACD Signal", minval = 3,  group = g_momentum)

var string g_mr = "5. Mean-Reversion"
bb_len       = input.int(20, "BB Length",     minval = 10, group = g_mr)
bb_mult      = input.float(2.0, "BB StdDev",  minval = 1.0, step = 0.25, group = g_mr)

// ═══════════════════════════════════════════════════════════════
//  2. SMC CORE STATE (from BUS)
// ═══════════════════════════════════════════════════════════════

bool smc_connected = not na(src_schema) and src_schema == 7001
int  smc_state     = smc_connected ? math.round(src_state_code) : 0
bool smc_armed     = smc_connected and not na(src_armed) and src_armed > 0.5
float smc_quality  = smc_connected and not na(src_quality) ? src_quality : 0.0

// SMC score component (0–40 points)
float smc_score = 0.0
if smc_connected
    if smc_state >= 6      // ENTER LONG
        smc_score := 40.0
    else if smc_state == 5 // READY LONG
        smc_score := 35.0
    else if smc_state >= 3 // PREPARE (confirmed/building)
        smc_score := 20.0
    else if smc_state == 2 // armed
        smc_score := 10.0
    // BUS QualityScore is 0..100. Normalize it to a genuine max +5 bonus.
    float quality_bonus = math.min(5.0, math.max(0.0, smc_quality) * 0.05)
    smc_score := math.min(40.0, smc_score + quality_bonus)

// ═══════════════════════════════════════════════════════════════
//  3. TREND (EMA crossover + slope) — 0–25 points
// ═══════════════════════════════════════════════════════════════

float ema_f = ta.ema(close, ema_fast_len)
float ema_s = ta.ema(close, ema_slow_len)

bool ema_bull_cross   = ema_f > ema_s
bool ema_bull_slope   = ema_f > ema_f[1] and ema_s > ema_s[1]
bool price_above_emas = close > ema_f and close > ema_s

float trend_score = 0.0
if ema_bull_cross
    trend_score += 10.0
if ema_bull_slope
    trend_score += 8.0
if price_above_emas
    trend_score += 7.0

// ═══════════════════════════════════════════════════════════════
//  4. MOMENTUM (RSI + MACD) — 0–20 points
// ═══════════════════════════════════════════════════════════════

float rsi = ta.rsi(close, rsi_len)
[macd_line, signal_line, hist_line] = ta.macd(close, macd_fast, macd_slow, macd_signal)

bool rsi_bullish    = rsi > 50 and rsi < 80
bool macd_bullish   = macd_line > signal_line
bool macd_rising    = hist_line > hist_line[1]

float momentum_score = 0.0
if rsi_bullish
    momentum_score += 8.0
if macd_bullish
    momentum_score += 7.0
if macd_rising
    momentum_score += 5.0

// ═══════════════════════════════════════════════════════════════
//  5. MEAN-REVERSION (Bollinger Band position) — 0–15 points
// ═══════════════════════════════════════════════════════════════

float bb_basis = ta.sma(close, bb_len)
float bb_dev   = ta.stdev(close, bb_len) * bb_mult
float bb_upper = bb_basis + bb_dev
float bb_lower = bb_basis - bb_dev

// Where is price within the band? 0 = at lower, 1 = at upper
float bb_position = bb_dev > 0 ? (close - bb_lower) / (bb_upper - bb_lower) : 0.5

// For long bias: best entry near lower band, worst near upper
// Score peaks when price is in lower half (mean-reversion dip)
float mr_score = 0.0
if bb_position < 0.3
    mr_score := 15.0  // deep dip — high MR score
else if bb_position < 0.5
    mr_score := 10.0  // lower half — moderate
else if bb_position < 0.7
    mr_score := 5.0   // neutral zone
// Above 0.7: extended, no MR credit

// ═══════════════════════════════════════════════════════════════
//  6. MARKET REGIME (from library) — penalty/bonus
// ═══════════════════════════════════════════════════════════════

float regime_modifier = 0.0
if smc_connected
    if mp.TRADE_STATE == "BLOCKED"
        regime_modifier := -20.0
    else if mp.TRADE_STATE == "DISCOURAGED"
        regime_modifier := -10.0
    if mp.HIGH_IMPACT_MACRO_TODAY
        regime_modifier -= 5.0

// ═══════════════════════════════════════════════════════════════
//  7. CONFLUENCE SCORE (0–100)
// ═══════════════════════════════════════════════════════════════

float raw_score = smc_score + trend_score + momentum_score + mr_score + regime_modifier
float confluence = math.max(0.0, math.min(100.0, raw_score))
bool regime_blocks_trade = smc_connected and mp.TRADE_STATE == "BLOCKED"
bool trade_zone = confluence >= 70 and not regime_blocks_trade

// Traffic light
string traffic = regime_blocks_trade ? "🔴  BLOCKED" : trade_zone ? "🟢  TRADE" : confluence >= 45 ? "🟡  WATCH" : "🔴  STAY AWAY"
color  traffic_color = trade_zone ? color.new(color.green, 70) : confluence >= 45 and not regime_blocks_trade ? color.new(color.orange, 70) : color.new(color.red, 70)

// ═══════════════════════════════════════════════════════════════
//  8. RENDER
// ═══════════════════════════════════════════════════════════════

// Background tint
bgcolor(show_bg and trade_zone ? color.new(color.green, 92) : show_bg and (regime_blocks_trade or confluence < 30) ? color.new(color.red, 95) : na)

// Confluence table
var table conf_tbl = table.new(position.top_right, 2, 9, border_width = 0)

conf_row(table tbl, int row, string label_text, string value_text, color bg, color txt) =>
    table.cell(tbl, 0, row, label_text, bgcolor = bg, text_color = txt, text_halign = text.align_left,  text_size = size.small)
    table.cell(tbl, 1, row, value_text, bgcolor = bg, text_color = txt, text_halign = text.align_right, text_size = size.small)

if show_table and barstate.islast
    color txt = chart.fg_color
    color header_bg = color.new(color.black, 100)
    color ok_bg = color.new(color.teal, 85)
    color warn_bg = color.new(color.orange, 80)
    color dim_bg = color.new(color.gray, 85)

    conf_row(conf_tbl, 0, "Confluence", traffic + "  " + str.tostring(confluence, '#') + "/100", traffic_color, txt)

    // Component breakdown
    color smc_bg = smc_connected ? (smc_score >= 20 ? ok_bg : warn_bg) : color.new(color.red, 80)
    conf_row(conf_tbl, 1, "SMC Zone",  smc_connected ? str.tostring(smc_score, '#') + "/40" : "not linked", smc_bg, txt)
    conf_row(conf_tbl, 2, "Trend",     str.tostring(trend_score, '#') + "/25", trend_score >= 15 ? ok_bg : trend_score >= 8 ? warn_bg : dim_bg, txt)
    conf_row(conf_tbl, 3, "Momentum",  str.tostring(momentum_score, '#') + "/20", momentum_score >= 12 ? ok_bg : momentum_score >= 7 ? warn_bg : dim_bg, txt)
    conf_row(conf_tbl, 4, "MR Dip",    str.tostring(mr_score, '#') + "/15", mr_score >= 10 ? ok_bg : mr_score >= 5 ? warn_bg : dim_bg, txt)

    if regime_modifier < 0
        conf_row(conf_tbl, 5, "Regime", str.tostring(regime_modifier, '#'), color.new(color.red, 80), txt)
    else
        conf_row(conf_tbl, 5, "Regime", "clear", ok_bg, txt)

    // Market context from library
    string market_ctx = mp.MARKET_REGIME + " · " + mp.TRADE_STATE
    color market_bg = mp.TRADE_STATE == "BLOCKED" ? color.new(color.red, 80) : mp.TRADE_STATE == "DISCOURAGED" ? color.new(color.orange, 80) : ok_bg
    conf_row(conf_tbl, 6, "Market", market_ctx, market_bg, txt)

    // Zone Priority from generated library (C9)
    string zp_rank = mp.ZONE_PRIORITY_RANK
    int zp_score = mp.ZONE_PRIORITY_SCORE
    string zp_catalyst = mp.ZONE_PRIORITY_CATALYST
    string zp_line = zp_rank + " " + str.tostring(zp_score) + "/100"
    if zp_catalyst != "NONE" and zp_catalyst != ""
        zp_line += " · " + zp_catalyst
    color zp_bg = zp_rank == "A" ? ok_bg : zp_rank == "B" ? ok_bg : zp_rank == "C" ? warn_bg : color.new(color.red, 80)
    conf_row(conf_tbl, 7, "Zone Prio", zp_line, zp_bg, txt)

    // Risk plan if SMC has an active zone
    bool has_zone = smc_connected and not na(src_trigger) and src_trigger > 0
    if has_zone
        string plan = "Entry " + str.tostring(src_trigger, format.mintick) + " | Stop " + str.tostring(src_invalid, format.mintick)
        conf_row(conf_tbl, 8, "Plan", plan, ok_bg, txt)
    else
        conf_row(conf_tbl, 8, "Plan", "no active zone", dim_bg, txt)
else if barstate.islast and not show_table
    table.clear(conf_tbl, 0, 0, 1, 8)

// ── Plots for external consumption ──
plot(confluence, "Confluence Score", display = display.none)
plot(smc_score,  "SMC Component",   display = display.none)

// ── Alert Conditions ──
_alertGate = barCloseOnly ? barstate.isconfirmed : true
alertcondition(trade_zone and not trade_zone[1] and _alertGate, "Confluence: Trade Zone", "Confluence score entered the unblocked trade zone — conditions favor a long setup.")
alertcondition(confluence < 30 and confluence[1] >= 30 and _alertGate, "Confluence: Stay Away",  "Confluence score dropped below 30 — conditions deteriorated.")

Overview

SMC Confluence Hub combines EMA trend, RSI, MACD momentum, and Bollinger Bands mean-reversion metrics to generate a unified confluence score specifically tailored for bullish long-dip setups. The script displays an on-screen HUD panel and optionally highlights the chart background when high-confluence conditions are met. Settings allow customization of indicator parameters, table visibility, and alert bar-close conditions.

Details

Published by

skipp-dev on GitHub

Code credit

preuss_steffen, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Oscillators & momentum, Moving averages, Screeners & dashboards

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show Confluence Panelbooltrueshow_table
Highlight Confluence BGbooltrueshow_bg
Alerts nur am Bar-ClosebooltruebarCloseOnly
BUS SchemaVersionsourceclosesrc_schema
BUS Armedsourceclosesrc_armed
BUS Triggersourceclosesrc_trigger
BUS Invalidationsourceclosesrc_invalid
BUS QualityScoresourceclosesrc_quality
BUS StateCodesourceclosesrc_state_code
EMA Fastint21ema_fast_len
EMA Slowint55ema_slow_len
RSI Lengthint14rsi_len
Show all 17 settings
SettingTypeDefaultVariable
MACD Fastint12macd_fast
MACD Slowint26macd_slow
MACD Signalint9macd_signal
BB Lengthint20bb_len
BB StdDevfloat2.0bb_mult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This overlay indicator plots a Supertrend from an ATR length and factor, four exponential moving averages, and a selectable VWAP or TWAP taken from a chosen timeframe on the price chart. It also shows MACD and stochastic with adjustable lengths, smoothing, ver

Indicator v5 Oscillators & momentumMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup: Vijay Thakare Option Buying Scalping Setup
218 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist

8zz反指標v2

by hansai-art
121 stars

The 8zz Contrarian Indicator plots reverse sentiment trading signals directly on the price chart based on tracked retail post activity. It generates bullish signals during retail panic and bearish signals during market euphoria. The indicator features adjustab

Indicator v6 Moving averagesOscillators & momentum
Updated 3 months ago · None stated GitHub repository of 8zz反指標v2
53 stars

This indicator analyzes historical candle direction and price range over a configurable lookback window to gauge market trend. It categorizes trend direction using candle count, price range sum, or both. Signals are filtered using a Simple Moving Average to en

Indicator v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of Candle Counter + MA + RSI + Mode

Pocket Scout - SPY/QQQ

by chris-c-thomas
14 stars

Pocket Scout - SPY/QQQ is a mobile-optimized intraday bias indicator designed for major US equity ETFs and indices. It overlays a 9/21/50 EMA ribbon, session VWAP, prior day high/low/close levels, and intraday high/low lines directly on the main price chart. T

Indicator v6 TrendOscillators & momentum Repaints
Updated 6 months ago · MIT GitHub repository of Pocket Scout - SPY/QQQ

Portfolio Backtester

by f-cksociety
11 stars

The script is a Pine Script v5 indicator that emulates strategy backtesting directly on the price chart. It evaluates modular entry strategies, trade directions, entry stop-loss types such as ATR multiples or fixed percentages, and a wide variety of trade filt

Indicator v5 TrendOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of Portfolio Backtester

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers