Indicator · Pine Script v6 · On the chart

SMC Long-Dip Mobile

by skipp-dev· code credited to preuss_steffen

SMC Long-Dip Mobile is a compact companion surface and HUD indicator designed for mobile or small-screen chart viewing.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code169
Settings13inputs
LicenceNone statedfile: MPL-2.0
Last update4 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

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

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

// Product role: companion operator-only surface for mobile / small screens.
// Product scope: this dashboard reflects the long-dip specialist mainline of SMC Core.

indicator("SMC Long-Dip Mobile", overlay = true)

import preuss_steffen/smc_micro_profiles_generated/569 as mp

var string g_mobile_surface = "Mobile Surface"
color_theme = input.string("Standard", "Color Theme", options = ["Standard", "Colorblind Safe"], group = g_mobile_surface, tooltip = "Match this to the SMC Long-Dip Suite color theme. Colorblind Safe replaces red/green with orange/blue.")
var bool _cb = color_theme == "Colorblind Safe"
var color M_BULL    = _cb ? #1f77b4 : color.green
var color M_ALT     = _cb ? color.new(#1f77b4, 20) : color.teal
var color M_CAUTION = _cb ? #bcbd22 : color.orange
var color M_BEAR    = _cb ? #ff7f0e : color.red
var color M_NEUTRAL = color.gray

var string g_bus = "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_bus_schema_version = input.source(close, "BUS SchemaVersion", group = g_bus, display = display.none)
src_armed              = input.source(close, "BUS Armed",          group = g_bus, display = display.none)
src_confirmed          = input.source(close, "BUS Confirmed",      group = g_bus, display = display.none)
src_ready              = input.source(close, "BUS Ready",          group = g_bus, display = display.none)
src_trigger            = input.source(close, "BUS Trigger",        group = g_bus, display = display.none)
src_invalidation       = input.source(close, "BUS Invalidation",   group = g_bus, display = display.none)
src_quality_score      = 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_trade_mgmt = "Trade Management (optional)"
tm_enable      = input.bool(false, "Enable Trade-Mgmt rows",        group = g_trade_mgmt, tooltip = "Adds 2 extra rows to the table: Trade-State (FLAT/ARMED/IN-TRADE) and live Stop. Same logic as SMC_Exit_Signal.")
tm_tp1_r       = input.float(1.5,  "TP1 (R-multiple)",              group = g_trade_mgmt, minval = 0.25, step = 0.25, active = tm_enable)
tm_tp2_r       = input.float(3.0,  "TP2 (R-multiple)",              group = g_trade_mgmt, minval = 0.5,  step = 0.25, active = tm_enable)
tm_be_after_t1 = input.bool(true,  "Move stop to break-even after TP1", group = g_trade_mgmt, active = tm_enable)

// ── BUS Schema Version Check ──
int expected_bus_version = 7001
bool bus_ok = math.round(src_bus_schema_version) == expected_bus_version

// ── Decode ──
int state_code = int(math.round(nz(src_state_code, 0.0)))
bool actionable = state_code >= 5

// ── Traffic light — hero action from generated library ──
// HERO_ACTION vocab anchor (cross-checked by tests/test_pine_python_vocab_cross_check.py):
//   "ACTIVE", "WATCH", "AVOID", "BLOCKED"  ← keep in sync with scripts/smc_hero_state.py::HERO_ACTION_VOCAB
// HERO_BIAS vocab anchor:
//   "LONG", "SHORT", "FLAT", "UNKNOWN" (waiting-state sentinel, #55)
string hero_action_m = mp.HERO_ACTION
string hero_bias_m = mp.HERO_BIAS
string action_text = hero_action_m == "ACTIVE" ? (hero_bias_m == "LONG" ? "🟢 ACTIVE LONG" : hero_bias_m == "SHORT" ? "🟢 ACTIVE SHORT" : "🟢 ACTIVE") : hero_action_m == "BLOCKED" ? "🔴 BLOCKED" : hero_action_m == "AVOID" ? "🔴 AVOID" : hero_bias_m == "UNKNOWN" ? "⚪ awaiting data" : "⚪ WATCH"
color  action_bg   = hero_action_m == "ACTIVE" ? color.new(M_BULL, 65) : hero_action_m == "BLOCKED" or hero_action_m == "AVOID" ? color.new(M_BEAR, 65) : color.new(M_NEUTRAL, 75)

// ── Levels ──
string levels_text = actionable and not na(src_trigger) ? str.tostring(src_trigger, format.mintick) + " → " + str.tostring(src_invalidation, format.mintick) : "—"

// ── Market context from hero state ──
// HERO_MARKET_MODE vocab anchor (cross-checked by tests/test_pine_python_vocab_cross_check.py):
//   "BULLISH", "BEARISH", "NEUTRAL", "RISK_OFF", "UNKNOWN" (waiting-state sentinel, #55)
//   ← keep in sync with scripts/smc_hero_state.py
string hero_market_m = mp.HERO_MARKET_MODE
string hero_market_display = hero_market_m == "UNKNOWN" ? "⚪ awaiting data" : hero_market_m
string hero_trust_m = mp.HERO_TRUST
// ENG-WS2-03: surface the canonical product trust state on mobile too so
// stale/degraded/watch-only is visible without opening Audit View. The
// generated library always emits mp.TRUST_STATE (default "healthy"), so
// this is safe to read unconditionally.
string product_trust_m = mp.TRUST_STATE
string product_trust_emoji_m = product_trust_m == "healthy" ? "✓" : product_trust_m == "degraded" ? "⚠ degraded" : product_trust_m == "stale" ? "⚠ stale" : product_trust_m == "watch_only" ? "⛔ watch-only" : product_trust_m == "unavailable" ? "⛔ no data" : "?"
string context_text = hero_market_display + " · " + product_trust_emoji_m
bool product_trust_bad_m = product_trust_m == "degraded" or product_trust_m == "stale" or product_trust_m == "watch_only" or product_trust_m == "unavailable"

// ── Quality from hero state ──
// HERO_SETUP_QUALITY vocab anchor: "high", "good", "ok", "low", "unavailable" (waiting-state sentinel, #55)
string hero_quality_raw_m = mp.HERO_SETUP_QUALITY
string hero_quality_m = hero_quality_raw_m == "unavailable" ? "⚪ awaiting data" : hero_quality_raw_m

// ── Why now / Risk from hero state ──
string hero_why_m = mp.HERO_WHY_NOW
string hero_risk_m = mp.HERO_RISK
string extra_line = hero_why_m != "" ? hero_why_m : hero_risk_m != "" ? hero_risk_m : "—"

// ── Render ──
var table mob = table.new(position.bottom_right, 2, 7, border_width = 0)

// ── Trade-Management mini state machine (mirrors SMC_Exit_Signal) ──
// FLAT (0) → ARMED (1) → IN_TRADE (2). Stop bumps to entry on TP1 hit when
// tm_be_after_t1 is true. No alerts here — Mobile is read-only; for alerts
// link SMC_Exit_Signal or SMC_Hold_Manager on the same chart.
tm_armed_flag     = not na(src_armed) and src_armed > 0.5
tm_confirmed_flag = not na(src_confirmed) and src_confirmed > 0.5
tm_ready_flag     = not na(src_ready) and src_ready > 0.5
tm_any_state      = tm_armed_flag or tm_confirmed_flag or tm_ready_flag
tm_risk_ok        = not na(src_trigger) and not na(src_invalidation) and src_trigger > src_invalidation

var int   tm_state         = 0
var float tm_entry_price   = na
var float tm_entry_stop    = na
var float tm_tp1_price     = na
var float tm_tp2_price     = na
var bool  tm_tp1_hit       = false

if tm_enable
    if tm_state == 0 and tm_any_state and tm_risk_ok
        tm_state := 1
        tm_entry_price := src_trigger
        tm_entry_stop  := src_invalidation
        tm_tp1_price   := src_trigger + (src_trigger - src_invalidation) * tm_tp1_r
        tm_tp2_price   := src_trigger + (src_trigger - src_invalidation) * tm_tp2_r
        tm_tp1_hit     := false
    if tm_state == 1 and tm_risk_ok
        tm_entry_price := src_trigger
        tm_entry_stop  := src_invalidation
        tm_tp1_price   := src_trigger + (src_trigger - src_invalidation) * tm_tp1_r
        tm_tp2_price   := src_trigger + (src_trigger - src_invalidation) * tm_tp2_r
    if tm_state == 1 and not na(tm_entry_price) and high >= tm_entry_price
        tm_state := 2
    if tm_state == 1 and not tm_any_state
        tm_state := 0
        tm_entry_price := na, tm_entry_stop := na, tm_tp1_price := na, tm_tp2_price := na
    if tm_state == 2
        if not tm_tp1_hit and not na(tm_tp1_price) and high >= tm_tp1_price
            tm_tp1_hit := true
            if tm_be_after_t1 and not na(tm_entry_price)
                tm_entry_stop := math.max(tm_entry_stop, tm_entry_price)
        bool tm_full_exit = (not na(tm_entry_stop) and close < tm_entry_stop) or (not na(tm_tp2_price) and high >= tm_tp2_price)
        if tm_full_exit
            tm_state := 0
            tm_entry_price := na, tm_entry_stop := na, tm_tp1_price := na, tm_tp2_price := na, tm_tp1_hit := false

string tm_state_txt = tm_state == 0 ? "FLAT" : tm_state == 1 ? "ARMED" : "IN-TRADE"
color  tm_state_bg  = tm_state == 0 ? color.new(M_NEUTRAL, 80) : tm_state == 1 ? color.new(M_CAUTION, 70) : color.new(M_BULL, 65)
string tm_stop_txt  = na(tm_entry_stop) ? "—" : str.tostring(tm_entry_stop, format.mintick) + (tm_tp1_hit and tm_be_after_t1 ? " (BE)" : "")

if barstate.islast and bus_ok
    color txt = chart.fg_color
    color hdr = color.new(color.black, 100)
    table.cell(mob, 0, 0, "SMC",     text_color = txt, bgcolor = hdr,       text_size = size.normal, text_halign = text.align_left)
    table.cell(mob, 1, 0, action_text, text_color = txt, bgcolor = action_bg, text_size = size.large,  text_halign = text.align_right)
    table.cell(mob, 0, 1, "Levels",  text_color = txt, bgcolor = hdr,       text_size = size.normal, text_halign = text.align_left)
    table.cell(mob, 1, 1, levels_text, text_color = txt, bgcolor = actionable ? color.new(M_ALT, 80) : hdr, text_size = size.normal, text_halign = text.align_right)
    table.cell(mob, 0, 2, "Market",  text_color = txt, bgcolor = hdr,       text_size = size.normal, text_halign = text.align_left)
    table.cell(mob, 1, 2, context_text, text_color = txt, bgcolor = product_trust_bad_m or hero_trust_m == "degraded" or hero_trust_m == "stale" or hero_trust_m == "unavailable" ? color.new(M_BEAR, 75) : hero_market_m == "BULLISH" ? color.new(M_ALT, 80) : hero_market_m == "BEARISH" or hero_market_m == "RISK_OFF" ? color.new(M_BEAR, 80) : color.new(M_NEUTRAL, 80), text_size = size.normal, text_halign = text.align_right)
    table.cell(mob, 0, 3, "Quality", text_color = txt, bgcolor = hdr,       text_size = size.normal, text_halign = text.align_left)
    table.cell(mob, 1, 3, hero_quality_m, text_color = txt, bgcolor = hero_quality_m == "high" or hero_quality_m == "good" ? color.new(M_BULL, 75) : hero_quality_m == "ok" ? color.new(M_CAUTION, 75) : color.new(M_NEUTRAL, 80), text_size = size.normal, text_halign = text.align_right)
    table.cell(mob, 0, 4, "Context", text_color = txt, bgcolor = hdr,       text_size = size.normal, text_halign = text.align_left)
    table.cell(mob, 1, 4, extra_line, text_color = txt, bgcolor = hero_risk_m != "" ? color.new(M_CAUTION, 80) : hero_why_m != "" ? color.new(M_ALT, 85) : hdr, text_size = size.normal, text_halign = text.align_right)
    if tm_enable
        table.cell(mob, 0, 5, "Trade",  text_color = txt, bgcolor = hdr, text_size = size.normal, text_halign = text.align_left)
        table.cell(mob, 1, 5, tm_state_txt, text_color = txt, bgcolor = tm_state_bg, text_size = size.normal, text_halign = text.align_right)
        table.cell(mob, 0, 6, "Stop",   text_color = txt, bgcolor = hdr, text_size = size.normal, text_halign = text.align_left)
        table.cell(mob, 1, 6, tm_stop_txt, text_color = txt, bgcolor = tm_state == 2 ? color.new(M_BEAR, 65) : hdr, text_size = size.normal, text_halign = text.align_right)
    else
        // Clear stale Trade/Stop rows when tm_enable is toggled off mid-session
        // and reset the state machine so a re-enable starts FLAT.
        table.clear(mob, 0, 5, 1, 6)
        tm_state := 0
        tm_entry_price := na, tm_entry_stop := na, tm_tp1_price := na, tm_tp2_price := na, tm_tp1_hit := false
else if barstate.islast and not bus_ok
    table.cell(mob, 0, 0, "SMC Mobile", text_color = chart.fg_color, bgcolor = color.new(color.red, 70), text_size = size.normal)
    table.cell(mob, 1, 0, "❌ Add SMC Long-Dip Suite first", text_color = chart.fg_color, bgcolor = color.new(color.red, 70), text_size = size.normal)

// No overlays — mobile-optimized, table only

Overview

SMC Long-Dip Mobile links to the main SMC Long-Dip Suite indicator outputs via plot sources, displaying setup state, quality score, and hero action or bias statuses. Optional trade management rows calculate target levels using R-multiples for TP1 and TP2 and track break-even stop conditions directly on the chart overlay table. It features selectable colorblind-friendly color themes for improved accessibility on mobile devices.

Details

Published by

skipp-dev on GitHub

Code credit

preuss_steffen, as written in the script's header

Draws

On the price chart

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
Color ThemestringStandardcolor_theme
BUS SchemaVersionsourceclosesrc_bus_schema_version
BUS Armedsourceclosesrc_armed
BUS Confirmedsourceclosesrc_confirmed
BUS Readysourceclosesrc_ready
BUS Triggersourceclosesrc_trigger
BUS Invalidationsourceclosesrc_invalidation
BUS QualityScoresourceclosesrc_quality_score
BUS StateCodesourceclosesrc_state_code
Enable Trade-Mgmt rowsboolfalsetm_enable
TP1 (R-multiple)float1.5tm_tp1_r
TP2 (R-multiple)float3.0tm_tp2_r
Show all 13 settings
SettingTypeDefaultVariable
Move stop to break-even after TP1booltruetm_be_after_t1
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

575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator

Golden Bullet Strategy

by TradersPost
228 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
56 stars

This indicator identifies fractal-based pivot highs and lows to map out market structure directly on the price chart. It detects bullish and bearish structure breaks, automatically labeling Break of Structure (BOS) and Change of Character (ChoCH) events when p

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of Market Structure (Fractal)
53 stars

Apex Trend & Liquidity Master calculates a trend cloud using customizable moving averages expanded by a volatility multiplier directly on the main price chart. It identifies dynamic support and resistance liquidity zones from swing high and low pivots, extendi

Indicator v6 TrendSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Apex Trend & Liquidity Master
23 stars

MTF State of Delivery tracks lower timeframe and higher timeframe orderflow delivery states by identifying bullish and bearish delivery levels across timeframes. It plots confirmed and pending orderflow lines directly on the price chart and provides an optiona

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 4 weeks ago · Custom licence GitHub repository of MTF State of Delivery by traderprimez

More SMC / ICT scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers