PINE LIBRARY

lib_smt

205
Library "lib_smt"
SMT divergence + session detection/lifecycle, SMT buffers, premium/discount zones, and their on-chart drawing — extracted 1:1 from rewrite_strategy.pine.

method equals(this, other)
  Namespace types: SMT
  Parameters:
    this (SMT)
    other (SMT)

method delete_smt(this)
  Namespace types: SMT
  Parameters:
    this (SMT)

method delete_smts(this)
  Namespace types: array<SMT>
  Parameters:
    this (array<SMT>)

method replace(this, value)
  Namespace types: array<Session>
  Parameters:
    this (array<Session>)
    value (Session)

method replace(sess, idx, value, remove_buffer)
  Namespace types: array<Session>
  Parameters:
    sess (array<Session>)
    idx (int)
    value (Session)
    remove_buffer (array<Session>)

method reset(this)
  Namespace types: SessionSignals
  Parameters:
    this (SessionSignals)

method reset(this)
  Namespace types: SessionLevel
  Parameters:
    this (SessionLevel)

method reset(this)
  Namespace types: Session
  Parameters:
    this (Session)

method invalidate_smt(this, smt, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    smt (SMT)
    reason (series SMTFilterReason)

method invalidate_session(this, sess, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    sess (Session)
    reason (series SMTFilterReason)

method set_intra(this, smt)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    smt (SMT)

method reset_intra(this, reason, sess, reset_bull, reset_bear)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    reason (series SMTFilterReason)
    sess (Session)
    reset_bull (bool)
    reset_bear (bool)

method invalidate_all_daily_smts(this, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    reason (series SMTFilterReason)

method invalidate_all_session_smts(this, is_bullish, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    is_bullish (bool)
    reason (series SMTFilterReason)

method invalidate_entry_daily_smt(this, entry_smt, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    entry_smt (SMT)
    reason (series SMTFilterReason)

method invalidate_by_detected_session_id(this, id, reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    id (int)
    reason (series SMTFilterReason)

method invalidate_swept_sessions(this, session_signals, overflow_buffer)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    session_signals (SessionSignals)
    overflow_buffer (array<Session>)

method add_smt(this, smt)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    smt (SMT)

method update_smt(this, other_high, other_low, smt_buffer, enable_invalidation_by_distance, invalidation_dist_chart_led, invalidation_dist_other_led)
  Namespace types: SMT
  Parameters:
    this (SMT)
    other_high (float)
    other_low (float)
    smt_buffer (SMTBuffer)
    enable_invalidation_by_distance (bool)
    invalidation_dist_chart_led (float)
    invalidation_dist_other_led (float)

method update_smts(this, other_high, other_low, enable_invalidation_by_distance, invalidation_dist_chart_led, invalidation_dist_other_led)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    other_high (float)
    other_low (float)
    enable_invalidation_by_distance (bool)
    invalidation_dist_chart_led (float)
    invalidation_dist_other_led (float)

method update_session_level_sweeps(this, other_high, other_low)
  Namespace types: Session
  Parameters:
    this (Session)
    other_high (float)
    other_low (float)

method detect_smt(this, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_buffer, active_session_id, smt_min_age, is_intra, is_blocked_intra_smt_bull, is_blocked_intra_smt_bear, timeout_intra, touch_tolerance, intra_min_swing_age)
  ─────────────────────────────────────────────────────────────────────────────
session.detect_smt — check if chart/other has swept H or L
§2.2.1 Level SMT Detection / §2.2.2 Daily SMT Detection / §2.2.3 Intra SMT Detection
is_intra=true → called on live active session (§2.2.3); uses running H/L, equal high/low counts
is_intra=false → called on archived session (§2.2.1/§2.2.2); levels are fixed at capture time
active_session_id: session currently open, stored as detected_session_id on new SMTs
so §2.3.2 London-detected invalidation can filter correctly on NY open
─────────────────────────────────────────────────────────────────────────────
  Namespace types: Session
  Parameters:
    this (Session)
    smt_h1 (float)
    smt_l1 (float)
    smt_c1 (float)
    smt_other_h1 (float)
    smt_other_l1 (float)
    is_smt_tf_new_bar (bool)
    smt_buffer (SMTBuffer)
    active_session_id (int)
    smt_min_age (int)
    is_intra (bool)
    is_blocked_intra_smt_bull (bool)
    is_blocked_intra_smt_bear (bool)
    timeout_intra (int)
    touch_tolerance (float)
    intra_min_swing_age (int)

method detect_smts(this, signals, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_buffer, active_session_id, smt_min_age, touch_tolerance)
  Namespace types: array<Session>
  Parameters:
    this (array<Session>)
    signals (SessionSignals)
    smt_h1 (float)
    smt_l1 (float)
    smt_c1 (float)
    smt_other_h1 (float)
    smt_other_l1 (float)
    is_smt_tf_new_bar (bool)
    smt_buffer (SMTBuffer)
    active_session_id (int)
    smt_min_age (int)
    touch_tolerance (float)

method has_active_daily_smt(this, seeks_bullish)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    seeks_bullish (bool)

method find_best_smt_by_prio(this, minimum_prio, seeks_bullish)
  Namespace types: array<SMT>
  Parameters:
    this (array<SMT>)
    minimum_prio (int)
    seeks_bullish (bool)

method find_best_smt_by_direction(this, intra_smts_enabled, seeks_bullish)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    intra_smts_enabled (bool)
    seeks_bullish (bool)

method update_best_smts(this, pd_zone, intra_smts_enabled, allow_bullish_intra_smt_post_cutoff_if_has_daily_smt_active, allow_bearish_intra_smt_post_cutoff_if_has_daily_smt_active)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    pd_zone (int)
    intra_smts_enabled (bool)
    allow_bullish_intra_smt_post_cutoff_if_has_daily_smt_active (bool)
    allow_bearish_intra_smt_post_cutoff_if_has_daily_smt_active (bool)

method rotate(this, sess, max)
  Namespace types: array<Session>
  Parameters:
    this (array<Session>)
    sess (Session)
    max (int)

method add_session(this, sess, overflow_buffer)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    sess (Session)
    overflow_buffer (array<Session>)

method evict_consumed_days(this, overflow_buffer, max_history_days)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    overflow_buffer (array<Session>)
    max_history_days (simple int)

method clear_invalidated_smts(this, keep_level, keep_intra, keep_reason)
  Namespace types: SMTBuffer
  Parameters:
    this (SMTBuffer)
    keep_level (bool)
    keep_intra (bool)
    keep_reason (bool)

method archive(this)
  Namespace types: SessionLevel
  Parameters:
    this (SessionLevel)

method archive(this)
  Namespace types: Session
  Parameters:
    this (Session)

method update_levels(this, is_smt_tf_new_bar, other_high, other_low, smt_t1, smt_h1, smt_l1, smt_other_h1, smt_other_l1)
  Namespace types: Session
  Parameters:
    this (Session)
    is_smt_tf_new_bar (bool)
    other_high (float)
    other_low (float)
    smt_t1 (int)
    smt_h1 (float)
    smt_l1 (float)
    smt_other_h1 (float)
    smt_other_l1 (float)

method update_session(this, signals, smt_buffer, new_day, other_high, other_low, smt_t1, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_min_age, timeout_intra, in_any_no_intra_smt_zone, enable_block_intra_smts_pre_high_prio_sweep, previous_session, intra_min_swing_age)
  Namespace types: Session
  Parameters:
    this (Session)
    signals (SessionSignals)
    smt_buffer (SMTBuffer)
    new_day (bool)
    other_high (float)
    other_low (float)
    smt_t1 (int)
    smt_h1 (float)
    smt_l1 (float)
    smt_c1 (float)
    smt_other_h1 (float)
    smt_other_l1 (float)
    is_smt_tf_new_bar (bool)
    smt_min_age (int)
    timeout_intra (int)
    in_any_no_intra_smt_zone (bool)
    enable_block_intra_smts_pre_high_prio_sweep (bool)
    previous_session (Session)
    intra_min_swing_age (int)

method draw_session(this, show_chart, show_panel)
  Namespace types: Session
  Parameters:
    this (Session)
    show_chart (bool)
    show_panel (bool)

method draw_session_consumed(this)
  Namespace types: Session
  Parameters:
    this (Session)

method delete(this)
  Namespace types: Session
  Parameters:
    this (Session)

method delete(this)
  Namespace types: array<SMT>
  Parameters:
    this (array<SMT>)

method register(this, enabled, session, _fill_color, _text, _text_color, _border_color, prio, id, is_daily, is_session, enable_intra_smts, is_no_intra_smt_zone, smt_timeout, strategy_config)
  Namespace types: array<Session>
  Parameters:
    this (array<Session>)
    enabled (bool)
    session (string)
    _fill_color (color)
    _text (string)
    _text_color (color)
    _border_color (color)
    prio (int)
    id (int)
    is_daily (bool)
    is_session (bool)
    enable_intra_smts (bool)
    is_no_intra_smt_zone (bool)
    smt_timeout (int)
    strategy_config (StrategyConfig)

method short_id(this)
  Namespace types: SMT
  Parameters:
    this (SMT)

method label_text(this, other_ticker, include_filter_reason, is_leader)
  Namespace types: SMT
  Parameters:
    this (SMT)
    other_ticker (string)
    include_filter_reason (bool)
    is_leader (bool)

method draw_smt(this, other_ticker, show_label_leader, show_label_follower, verbose)
  Namespace types: SMT
  Parameters:
    this (SMT)
    other_ticker (string)
    show_label_leader (bool)
    show_label_follower (bool)
    verbose (bool)

method draw_smts(this, other_ticker, show_label_leader, show_label_follower, show_filter_reason)
  Namespace types: array<SMT>
  Parameters:
    this (array<SMT>)
    other_ticker (string)
    show_label_leader (bool)
    show_label_follower (bool)
    show_filter_reason (bool)

get_pd_range(enable, bars_lookback, new_hour)
  Parameters:
    enable (simple bool)
    bars_lookback (int)
    new_hour (bool)

draw_pd(new_hour, pd_start, pd_high, pd_equilibrium, pd_low)
  Parameters:
    new_hour (bool)
    pd_start (int)
    pd_high (float)
    pd_equilibrium (float)
    pd_low (float)

SMT
  Fields:
    detected_session_id (series int)
    leader (series int)
    leader_level (chart.point)
    sweep (chart.point)
    follow_level (chart.point)
    session_id (series int)
    prio (series int)
    is_bullish (series bool)
    deprecate_at (series int)
    detection_bar (series int)
    detection_close (series float)
    valid_from (series int)
    invalidated (series bool)
    filter_reason (series SMTFilterReason)
    leader_line (series line)
    leader_label (series label)
    follow_line (series line)
    follow_intermediate_line (series line)
    follow_label (series label)
    smt_color (series color)
    draw_remove_highlight (series bool)
    used_for_trade (series bool)
    trade_end_time (series int)

SessionLevel
  tracks session H/L
  Fields:
    chart (chart.point)
    other (chart.point)
    chart_smt_tf (chart.point)
    other_smt_tf (chart.point)
    is_consumed (series bool)
    smt (SMT)

StrategyConfig
  Fields:
    big_win_threshold (series float)
    cutoff_hour (series int)
    cutoff_tz (series string)
    cutoff_mode (series SessionCutoffMode)
    max_losses (series int)
    max_wins (series int)

Session
  Fields:
    id (series int)
    prio (series int)
    timeout (series int)
    session (series string)
    h (SessionLevel)
    l (SessionLevel)
    _fill_color (series color)
    _text (series string)
    _text_color (series color)
    _border_color (series color)
    is_daily (series bool)
    is_session (series bool)
    is_no_intra_smt_zone (series bool)
    enable_intra_smts (series bool)
    strategy_config (StrategyConfig)
    start_time (series int)
    end_time (series int)
    cutoff_at (series int)
    is_active (series bool)
    is_consumed (series bool)
    box_chart (series box)
    box_other (series box)
    mean_sum (series float)
    mean_count (series float)
    mean (series float)
    is_any_low_swept (series bool)
    is_any_high_swept (series bool)
    draw_signal_consumed (series bool)
    tooltip_chart (series label)
    tooltip_other (series label)

SessionSignals
  Fields:
    signal_session_started (series int)
    signal_session_ending (series int)
    signal_session_ended (series int)
    signal_no_intra_smt_zone_started (series int)
    signal_no_intra_smt_zone_ending (series int)
    signal_no_intra_smt_zone_ended (series int)
    signal_intra_smt_h (series int)
    signal_intra_smt_l (series int)
    signal_session_consumed (series bool)

SMTBuffer
  Fields:
    session_smts (array<SMT>)
    daily_smts (array<SMT>)
    intra_smts (array<SMT>)
    invalidated (array<SMT>)
    delete_buffer (array<SMT>)
    monitored_sessions (array<Session>)
    monitored_days (array<Session>)
    consumed_days (array<Session>)
    max_days (series int)
    best_bull_smt (SMT)
    best_bear_smt (SMT)

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.