Indicator · Pine Script v6 · Own pane

SMC Context Bus

by skipp-dev· code credited to preuss_steffen

This indicator builds a smart-money context frame in a separate pane by calling a private context engine.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code130
Settings11inputs
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

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

SMC_Context_Bus.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

// Hidden, domain-first Context BUS v3 producer.
// Contract: schema 8001, exactly 62 direct channels, two TradingView plot
// slots reserved (2026-07-31: two spent on session MSS; additive within
// schema 8001 — bindings are by name and the reserve exists for this).
// This producer is observational and cannot gate Suite trades.
indicator("SMC Context Bus", overlay = false)

import preuss_steffen/smc_context_engine_private/5 as ctx

const int SCHEMA_VERSION = 8001

var g_build = "Context Builder"
swing_len = input.int(50, "Structure swing length", minval = 2, group = g_build)
fresh_bars = input.int(20, "Event freshness bars", minval = 1, group = g_build)
float fvg_size_threshold = input.float(0.0, "FVG size threshold", minval = 0.0, step = 0.1, group = g_build)
atr_len = input.int(50, "Order-block ATR length", minval = 2, group = g_build)
float ob_min_mult = input.float(0.5, "Order-block minimum ATR", minval = 0.0, step = 0.1, group = g_build)
float ob_max_mult = input.float(2.5, "Order-block maximum ATR", minval = 0.1, step = 0.1, group = g_build)
sweep_pivot_len = input.int(5, "Sweep pivot length", minval = 1, group = g_build)
sweep_volume_len = input.int(20, "Sweep volume length", minval = 1, group = g_build)
pool_pivot_len = input.int(5, "Pool pivot length", minval = 1, group = g_build)
float pool_tolerance_pct = input.float(0.1, "Pool tolerance %", minval = 0.01, step = 0.01, group = g_build)
pool_max_levels = input.int(20, "Pool candidate limit", minval = 2, maxval = 100, group = g_build)

ctx.ContextFrame frame = ctx.build_context_frame(
     swing_len, fresh_bars, fvg_size_threshold, atr_len, ob_min_mult,
     ob_max_mult, sweep_pivot_len, sweep_volume_len, pool_pivot_len,
     pool_tolerance_pct, pool_max_levels)

bool structure_available = frame.structure.trend != 0 or not na(frame.structure.support) or not na(frame.structure.resistance)
bool imbalance_available = frame.imbalance.state != 0
bool zone_available = frame.zone.state != 0
bool sweep_available = frame.sweep.fresh
bool pool_available = not na(frame.pool.buy_side_level) or not na(frame.pool.sell_side_level)
bool session_available = frame.session.session_code != 0
int availability_mask = (structure_available ? 1 : 0) +
     (imbalance_available ? 2 : 0) +
     (zone_available ? 4 : 0) +
     (sweep_available ? 8 : 0) +
     (pool_available ? 16 : 0) +
     (session_available ? 32 : 0)

var int confirmed_epoch = na
if barstate.isconfirmed
    confirmed_epoch := int(time_close / 1000)

bool ready = not na(confirmed_epoch) and frame.available_domains > 0

// Meta (4)
plot(SCHEMA_VERSION, "CTX SchemaVersion", display = display.none)
plot(ready ? 1 : 0, "CTX Ready", display = display.none)
plot(availability_mask, "CTX AvailabilityMask", display = display.none)
plot(confirmed_epoch, "CTX ConfirmedEpoch", display = display.none)

// Aggregate (3)
plot(frame.bias, "CTX Bias", display = display.none)
plot(frame.available_domains, "CTX AvailableDomains", display = display.none)
plot(frame.quality_score, "CTX QualityScore", display = display.none)

// Structure (7)
plot(frame.structure.trend, "CTX StructureTrend", display = display.none)
plot(frame.structure.bos ? 1 : 0, "CTX StructureBos", display = display.none)
plot(frame.structure.choch ? 1 : 0, "CTX StructureChoch", display = display.none)
plot(frame.structure.dir_event, "CTX StructureEventDirection", display = display.none)
plot(frame.structure.resistance, "CTX StructureResistance", display = display.none)
plot(frame.structure.support, "CTX StructureSupport", display = display.none)
plot(frame.structure.bars_since_event, "CTX StructureEventAgeBars", display = display.none)

// Imbalance (15)
plot(frame.imbalance.state, "CTX ImbalanceState", display = display.none)
plot(frame.imbalance.zone_bias, "CTX FvgBias", display = display.none)
plot(frame.imbalance.bull_fvg_active ? 1 : 0, "CTX BullFvgActive", display = display.none)
plot(frame.imbalance.bear_fvg_active ? 1 : 0, "CTX BearFvgActive", display = display.none)
plot(frame.imbalance.bull_fvg_top, "CTX BullFvgTop", display = display.none)
plot(frame.imbalance.bull_fvg_bottom, "CTX BullFvgBottom", display = display.none)
plot(frame.imbalance.bear_fvg_top, "CTX BearFvgTop", display = display.none)
plot(frame.imbalance.bear_fvg_bottom, "CTX BearFvgBottom", display = display.none)
plot(frame.imbalance.bpr_active ? 1 : 0, "CTX BprActive", display = display.none)
plot(frame.imbalance.bpr_dir, "CTX BprDirection", display = display.none)
plot(frame.imbalance.bpr_top, "CTX BprTop", display = display.none)
plot(frame.imbalance.bpr_bottom, "CTX BprBottom", display = display.none)
plot(frame.imbalance.liq_void_active ? 1 : 0, "CTX LiquidityVoidActive", display = display.none)
plot(frame.imbalance.liq_void_top, "CTX LiquidityVoidTop", display = display.none)
plot(frame.imbalance.liq_void_bottom, "CTX LiquidityVoidBottom", display = display.none)

// Zones (10)
plot(frame.zone.state, "CTX ZoneState", display = display.none)
plot(frame.zone.ob_bias, "CTX ObBias", display = display.none)
plot(frame.zone.bull_ob_top, "CTX BullObTop", display = display.none)
plot(frame.zone.bull_ob_bottom, "CTX BullObBottom", display = display.none)
plot(frame.zone.bear_ob_top, "CTX BearObTop", display = display.none)
plot(frame.zone.bear_ob_bottom, "CTX BearObBottom", display = display.none)
plot(frame.zone.bull_ob_new ? 1 : 0, "CTX BullObNew", display = display.none)
plot(frame.zone.bear_ob_new ? 1 : 0, "CTX BearObNew", display = display.none)
plot(frame.zone.bull_ob_broken ? 1 : 0, "CTX BullObBroken", display = display.none)
plot(frame.zone.bear_ob_broken ? 1 : 0, "CTX BearObBroken", display = display.none)

// Sweeps (7)
plot(frame.sweep.direction, "CTX SweepDirection", display = display.none)
plot(frame.sweep.sweep_type, "CTX SweepType", display = display.none)
plot(frame.sweep.zone_top, "CTX SweepZoneTop", display = display.none)
plot(frame.sweep.zone_bottom, "CTX SweepZoneBottom", display = display.none)
plot(frame.sweep.reclaim_active ? 1 : 0, "CTX SweepReclaimActive", display = display.none)
plot(frame.sweep.quality_score, "CTX SweepQualityScore", display = display.none)
plot(frame.sweep.bars_since_event, "CTX SweepEventAgeBars", display = display.none)

// Pools (6)
plot(frame.pool.buy_side_level, "CTX BuyPoolLevel", display = display.none)
plot(frame.pool.sell_side_level, "CTX SellPoolLevel", display = display.none)
plot(frame.pool.buy_side_strength, "CTX BuyPoolStrength", display = display.none)
plot(frame.pool.sell_side_strength, "CTX SellPoolStrength", display = display.none)
plot(frame.pool.magnet_direction, "CTX PoolMagnetDirection", display = display.none)
plot(frame.pool.imbalance, "CTX PoolImbalance", display = display.none)

// Session (8)
plot(frame.session.session_code, "CTX SessionCode", display = display.none)
plot(frame.session.in_killzone ? 1 : 0, "CTX SessionKillzone", display = display.none)
plot(frame.session.range_top, "CTX SessionRangeTop", display = display.none)
plot(frame.session.range_bottom, "CTX SessionRangeBottom", display = display.none)
plot(frame.session.opening_range_active ? 1 : 0, "CTX OpeningRangeActive", display = display.none)
plot(frame.session.opening_range_top, "CTX OpeningRangeTop", display = display.none)
plot(frame.session.opening_range_bottom, "CTX OpeningRangeBottom", display = display.none)
plot(frame.session.direction_bias, "CTX SessionDirection", display = display.none)
plot(frame.session.prev_session_break_bull ? 1 : 0, "CTX SessionMssBull", display = display.none)
plot(frame.session.prev_session_break_bear ? 1 : 0, "CTX SessionMssBear", display = display.none)

Overview

SMC Context Bus exposes hidden numeric plots for schema version, readiness, bias, quality, market structure including break of structure and change of character, imbalances, order-block zones, liquidity sweeps, buy-side and sell-side pools, and session state. Inputs set swing length, event freshness, fair-value-gap size, order-block ATR bounds, sweep pivots and volume, and pool tolerance and candidate limits. It is observational and does not place trades or draw visible marks.

Details

Published by

skipp-dev on GitHub

Code credit

preuss_steffen, as written in the script's header

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

SMC / ICT / price action, Support & resistance, Sessions & time

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
Structure swing lengthint50swing_len
Event freshness barsint20fresh_bars
FVG size thresholdfloat0.0fvg_size_threshold
Order-block ATR lengthint50atr_len
Order-block minimum ATRfloat0.5ob_min_mult
Order-block maximum ATRfloat2.5ob_max_mult
Sweep pivot lengthint5sweep_pivot_len
Sweep volume lengthint20sweep_volume_len
Pool pivot lengthint5pool_pivot_len
Pool tolerance %float0.1pool_tolerance_pct
Pool candidate limitint20pool_max_levels
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

AmiComStrategy

by amico1234
1 stars

AmiComStrategy is an indicator that calculates correlations between securities using the Corell indicator over specified timeframes such as 5D. It filters trading opportunities based on session times like 1300-1700 and security up and down times such as 3H. Th

Indicator v4 Sessions & timeVolatility & bands
Updated 2 years ago · None stated GitHub repository of AmiComStrategy

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

This indicator detects and draws the first Fair Value Gap (FVG) that forms in each hourly session based on a selected lower timeframe, with specialized handling for Regular Trading Hours (RTH) confluence windows. It draws FVG range boxes, midpoint lines, hourl

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints

This indicator combines six trading tools into a single chart overlay to optimize indicator limits. It calculates Bollinger Bands, projects weekend price boundaries, plots market structure elements like order blocks, breaker blocks, and MSB lines, marks New Yo

Indicator v6 Support & resistanceSMC / ICT / price action Repaints
19 stars

This indicator highlights Inner Circle Trader (ICT) killzones and key session pivot points directly on the price chart. It projects shaded boxes for specific trading sessions, including Asia, London, NY AM, NY Lunch, and NY PM, to help traders identify high-li

Indicator v5 SMC / ICT / price actionSessions & time
Updated 3 years ago · MIT GitHub repository of ICT Killzones & Pivots

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