Library · Pine Script v6 · Library

SMC Observability Private

by skipp-dev

This Pine Script library provides reusable helper functions for composing and formatting Smart Money Concepts (SMC) debug text strings and observability data.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code132
Settings0inputs
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 library, select all of the template text and paste. Press Save and give it a name.
  4. 4Publish or import itA library draws nothing. Publish it from the editor, then import its functions in your own scripts.

Source Code

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

smc_observability_private.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

//@version=6
library("smc_observability_private", overlay = true)

import preuss_steffen/smc_utils/4 as u

debug_mode_is_full(string long_engine_debug_mode) =>
    long_engine_debug_mode == 'Full'

compose_long_debug_compact_text(string long_setup_source_display, string long_ready_blocker_text, string long_strict_blocker_text) =>
    'src=' + long_setup_source_display + ' | rdy=' + long_ready_blocker_text + ' | st=' + long_strict_blocker_text

compose_long_debug_source_touch_text(string long_setup_source_display, int long_setup_backing_zone_touch_count) =>
    'src=' + long_setup_source_display + ' | touch=' + str.tostring(long_setup_backing_zone_touch_count)

compose_long_debug_ready_strict_text(string long_ready_blocker_text, string long_strict_blocker_text) =>
    'ready=' + long_ready_blocker_text + ' | strict=' + long_strict_blocker_text

compose_long_debug_fresh_source_text(string freshness_text, string source_state_text) =>
    'fresh=' + freshness_text + ' | ' + source_state_text

compose_long_debug_zone_env_text(string zone_quality_text, string long_environment_focus_display) =>
    'zone=' + zone_quality_text + ' | env=' + long_environment_focus_display

compose_long_debug_upgrade_text(string long_source_upgrade_reason) =>
    'upgrade=' + long_source_upgrade_reason

compose_long_debug_last_invalid_text(string long_last_invalid_source) =>
    'last=' + long_last_invalid_source

compose_long_debug_reason_text(string long_last_invalid_source) =>
    'reason=' + long_last_invalid_source

compose_long_debug_pipe_upgrade_text(string long_source_upgrade_reason) =>
    ' | ' + compose_long_debug_upgrade_text(long_source_upgrade_reason)

compose_long_debug_pipe_reason_text(string long_last_invalid_source) =>
    ' | ' + compose_long_debug_reason_text(long_last_invalid_source)

compose_long_debug_event_context_text(int long_setup_backing_zone_touch_count, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display) =>
    'touch=' + str.tostring(long_setup_backing_zone_touch_count) + ' | ' + compose_long_debug_fresh_source_text(freshness_text, source_state_text) + ' | ' + compose_long_debug_zone_env_text(zone_quality_text, long_environment_focus_display)

compose_long_debug_event_state_text(bool debug_mode_full, int long_setup_backing_zone_touch_count, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display, string long_ready_blocker_text, string long_strict_blocker_text) =>
    string event_state_text = ' | ' + compose_long_debug_ready_strict_text(long_ready_blocker_text, long_strict_blocker_text)
    if debug_mode_full
        event_state_text := ' | ' + compose_long_debug_event_context_text(long_setup_backing_zone_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display) + event_state_text
    event_state_text

compose_long_debug_primary_line(bool debug_mode_full, string long_setup_source_display, int long_setup_backing_zone_touch_count, string long_ready_blocker_text, string long_strict_blocker_text) =>
    string primary_line = compose_long_debug_compact_text(long_setup_source_display, long_ready_blocker_text, long_strict_blocker_text)
    if debug_mode_full
        primary_line := compose_long_debug_source_touch_text(long_setup_source_display, long_setup_backing_zone_touch_count)
    primary_line

compose_long_debug_full_summary_text(string long_setup_source_display, int long_setup_backing_zone_touch_count, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display, string long_ready_blocker_text, string long_strict_blocker_text) =>
    compose_long_debug_source_touch_text(long_setup_source_display, long_setup_backing_zone_touch_count) + ' | ' + compose_long_debug_fresh_source_text(freshness_text, source_state_text) + ' | ' + compose_long_debug_zone_env_text(zone_quality_text, long_environment_focus_display) + ' | ' + compose_long_debug_ready_strict_text(long_ready_blocker_text, long_strict_blocker_text)

compose_long_debug_event_header_text(string event_name, string long_setup_source_display, float long_setup_trigger, float long_invalidation_level) =>
    event_name + ' | src=' + long_setup_source_display + ' | trig=' + u.format_level(long_setup_trigger) + ' | inv=' + u.format_level(long_invalidation_level)

export compose_long_debug_summary_text(string long_engine_debug_mode, bool long_setup_armed, bool long_setup_confirmed, bool long_ready_state, string long_setup_source_display, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display, int long_setup_backing_zone_touch_count, bool long_source_upgrade_now, string long_source_upgrade_reason, string long_last_invalid_source, string long_ready_blocker_text, string long_strict_blocker_text) =>
    string debug_text = 'idle'
    bool debug_mode_full = debug_mode_is_full(long_engine_debug_mode)
    if long_setup_armed or long_setup_confirmed or long_ready_state
        if debug_mode_full
            debug_text := compose_long_debug_full_summary_text(long_setup_source_display, long_setup_backing_zone_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_ready_blocker_text, long_strict_blocker_text)
        else
            debug_text := compose_long_debug_primary_line(debug_mode_full, long_setup_source_display, long_setup_backing_zone_touch_count, long_ready_blocker_text, long_strict_blocker_text)
    else if long_last_invalid_source != 'None'
        debug_text := compose_long_debug_last_invalid_text(long_last_invalid_source)
    if long_source_upgrade_now
        debug_text += compose_long_debug_pipe_upgrade_text(long_source_upgrade_reason)
    debug_text

export compose_long_engine_event_log(string long_engine_debug_mode, string event_name, string long_setup_source_display, float long_setup_trigger, float long_invalidation_level, int long_setup_backing_zone_touch_count, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display, bool long_source_upgrade_now, string long_source_upgrade_reason, string long_last_invalid_source, string long_ready_blocker_text, string long_strict_blocker_text) =>
    bool debug_mode_full = debug_mode_is_full(long_engine_debug_mode)
    string event_text = compose_long_debug_event_header_text(event_name, long_setup_source_display, long_setup_trigger, long_invalidation_level)
    event_text += compose_long_debug_event_state_text(debug_mode_full, long_setup_backing_zone_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_ready_blocker_text, long_strict_blocker_text)
    if long_source_upgrade_now
        event_text += compose_long_debug_pipe_upgrade_text(long_source_upgrade_reason)
    if long_last_invalid_source != 'None'
        event_text += compose_long_debug_pipe_reason_text(long_last_invalid_source)
    event_text

export resolve_long_debug_event_values(bool long_invalidate_signal, string long_setup_source_display, string long_debug_event_source_display, int long_setup_backing_zone_touch_count, int long_debug_event_touch_count, float long_setup_trigger, float long_debug_event_trigger, float long_invalidation_level, float long_debug_event_invalidation) =>
    string debug_log_source_display = long_setup_source_display
    if long_invalidate_signal
        debug_log_source_display := long_debug_event_source_display
    int debug_log_touch_count = long_setup_backing_zone_touch_count
    if long_invalidate_signal
        debug_log_touch_count := long_debug_event_touch_count
    float debug_log_trigger = long_setup_trigger
    if long_invalidate_signal
        debug_log_trigger := long_debug_event_trigger
    float debug_log_invalidation = long_invalidation_level
    if long_invalidate_signal
        debug_log_invalidation := long_debug_event_invalidation
    [debug_log_source_display, debug_log_touch_count, debug_log_trigger, debug_log_invalidation]

export resolve_long_ready_signal_state(bool long_ready_state, bool prior_bar_ready_state, int ready_state_rt_prev, bool ready_fired_this_bar, bool current_bar_is_new) =>
    int helper_ready_state_rt_prev = ready_state_rt_prev
    bool helper_ready_fired_this_bar = ready_fired_this_bar
    if current_bar_is_new
        helper_ready_state_rt_prev := 0
        if prior_bar_ready_state
            helper_ready_state_rt_prev := 1
        helper_ready_fired_this_bar := false
    bool helper_long_ready_signal = false
    if long_ready_state and helper_ready_state_rt_prev == 0 and not helper_ready_fired_this_bar
        helper_long_ready_signal := true
    if helper_long_ready_signal
        helper_ready_fired_this_bar := true
    helper_ready_state_rt_prev := 0
    if long_ready_state
        helper_ready_state_rt_prev := 1
    [helper_ready_state_rt_prev, helper_ready_fired_this_bar, helper_long_ready_signal]

export emit_long_engine_debug_logs(bool show_long_engine_debug_eff, string long_engine_debug_mode_eff, bool long_source_upgrade_now, bool long_arm_signal, bool long_confirm_signal, bool long_ready_signal, bool long_invalidate_signal, bool long_state_armed, bool long_state_confirmed, bool long_ready_state, string long_setup_source_display, string long_debug_event_source_display, int long_state_backing_zone_touch_count, int long_debug_event_touch_count, float long_state_trigger, float long_debug_event_trigger, float long_state_invalidation_level, float long_debug_event_invalidation, string freshness_text, string source_state_text, string zone_quality_text, string long_environment_focus_display, string long_source_upgrade_reason, string long_last_invalid_source, string long_ready_blocker_text, string long_strict_blocker_text) =>
    [debug_log_source_display, debug_log_touch_count, debug_log_trigger, debug_log_invalidation] = resolve_long_debug_event_values(long_invalidate_signal, long_setup_source_display, long_debug_event_source_display, long_state_backing_zone_touch_count, long_debug_event_touch_count, long_state_trigger, long_debug_event_trigger, long_state_invalidation_level, long_debug_event_invalidation)
    string helper_summary = compose_long_debug_summary_text(long_engine_debug_mode_eff, long_state_armed, long_state_confirmed, long_ready_state, long_setup_source_display, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_state_backing_zone_touch_count, long_source_upgrade_now, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text)
    if show_long_engine_debug_eff and long_source_upgrade_now
        log.info('{0}', compose_long_engine_event_log(long_engine_debug_mode_eff, 'LONG UPGRADE', debug_log_source_display, debug_log_trigger, debug_log_invalidation, debug_log_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, true, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text))
    if show_long_engine_debug_eff and long_arm_signal
        log.info('{0}', compose_long_engine_event_log(long_engine_debug_mode_eff, 'LONG ARMED', debug_log_source_display, debug_log_trigger, debug_log_invalidation, debug_log_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_source_upgrade_now, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text))
    if show_long_engine_debug_eff and long_confirm_signal
        log.info('{0}', compose_long_engine_event_log(long_engine_debug_mode_eff, 'LONG CONFIRMED', debug_log_source_display, debug_log_trigger, debug_log_invalidation, debug_log_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_source_upgrade_now, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text))
    if show_long_engine_debug_eff and long_ready_signal
        log.info('{0}', compose_long_engine_event_log(long_engine_debug_mode_eff, 'LONG READY', debug_log_source_display, debug_log_trigger, debug_log_invalidation, debug_log_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_source_upgrade_now, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text))
    if show_long_engine_debug_eff and long_invalidate_signal
        log.info('{0}', compose_long_engine_event_log(long_engine_debug_mode_eff, 'LONG INVALID', debug_log_source_display, debug_log_trigger, debug_log_invalidation, debug_log_touch_count, freshness_text, source_state_text, zone_quality_text, long_environment_focus_display, long_source_upgrade_now, long_source_upgrade_reason, long_last_invalid_source, long_ready_blocker_text, long_strict_blocker_text))
    helper_summary

Overview

SMC Observability Private builds structured labels and diagnostic lines containing setup sources, zone quality metrics, touch counts, readiness blockers, and state indicators for trading engine analysis. Designed as a utility script overlay, it formats compact and full debug text strings to evaluate algorithm states, setup sources, and environment focus conditions across various market conditions.

Details

Published by

skipp-dev on GitHub

Draws

Library (no plots)

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.

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

AuthLib

by alboogycOdR
6 stars

AuthLib is a Pine Script utility library providing access control and state management structures for technical indicators. It checks callers against a hardcoded array of authorized TradingView usernames before executing operations. The library exports user-de

Library v5 SMC / ICT / price actionSessions & time
Updated 7 months ago · None stated GitHub repository of AuthLib

FVGDetectorLibrary

by alvinng214
2 stars

This Pine Script library detects and plots Smart Money Concept Fair Value Gaps (FVGs) for both demand and supply zones directly on the price chart. It exports a detection function that accepts configurable filter thresholds ranging from standard three-bar imba

Library v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of FVGDetectorLibrary

SFA FlowLiquidity v1

by genesisgrubio39
1 stars

The SFA FlowLiquidity library computes structural flow and liquidity events from price data. It detects sweep ups and downs with associated scores, identifies liquidity levels, and applies session and regime filters. Persistent arrays track liquidity prices, b

Library v6 SMC / ICT / price actionSupport & resistance
Updated 10 months ago · None stated GitHub repository of SFA FlowLiquidity v1

FunctionLinearRegression

by ricardosantos79
261 stars

This Pine Script v5 library provides functions to calculate and plot linear regression channels using sample point arrays. It evaluates paired X and Y arrays to calculate the regression slope, intercept, fitted values, maximum deviation, minimum deviation, and

Library v5 Trend
Updated 4 years ago · None stated GitHub repository of FunctionLinearRegression

PositionSizing

by iamrichardD
57 stars

This Pine Script v6 library calculates trade position sizes and provides risk management functions for external scripts. It computes position sizes from account equity, percentage risk, and stop-loss distance, and offers dynamic sizing adjustments based on vol

Library v6
Updated 1 year ago · Apache-2.0 GitHub repository of PositionSizing

Chart Patterns

by deepentropy
13 stars

Chart Patterns is a Pine Script v6 library designed to scan for and render technical chart patterns directly on the price chart. It defines custom user-defined types to configure scanning parameters, such as Zigzag pivot offsets, error ratios, flat ratios, and

Library v6 Repaints
Updated 6 months ago · MIT GitHub repository of Chart Patterns

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