QT_Mehr_Aria V5Here's a publish-ready description — it presents the tool's features and how to use it, while keeping every proprietary rule out (consistent with the sanitized script). I'll save it in the repo docs too.
Saved to tradingview-description.md. Here's the text to paste into the TradingView publication:
QT_Mehr_Aria V5 — Quarterly Theory Cycles + Triad SMT
WHAT IT DOES
This indicator maps the market's time structure into nested cycles based on Quarterly Theory — from 22/23-minute micro cycles up to yearly and 4-year cycles — and scans a triad of three correlated instruments for SMT divergence at every scale. It draws cycle boundaries, quarter labels and True Opens, and prints signal and entry marks with configurable triggers and alerts.
CYCLES
Nine nested scales: Micro (22/23 min), 90-Minute, 6H, Daily, Weekly, Monthly, Quarterly, Yearly and 4-Year — all anchored to the New York 18:00 session open, DST-safe. On every chart timeframe the indicator works three tiers (LTF / MTF / HTF); higher scales can be shown optionally. Supported chart timeframes: 1m, 5m, 15m, 1h, 4h, Daily, Weekly and Monthly.
SMT DETECTION
Choose a triad preset (NQ/ES/YM · DXY/EU/GU · NQ/ES/NKD · BTC/ETH/SOL · DXY/6E/6B · GC/SI/HG · ZB/TN/ZF) or set three custom symbols. Each symbol is evaluated against its own reference level inside the cycle structure; when the triad disagrees, a divergence mark prints on the bar where it happened:
▽ bearish SMT · △ bullish SMT · ▼ / ▲ entry marks · ✕ invalidated signal · Ts true sweep (optional) · ▽? / △? forming on the live bar (optional)
Inverse-correlated triads (e.g., DXY against EU/GU) are handled automatically — custom triads get per-symbol inverse switches. Detection basis is selectable (wick, close, or wick+close confluence), and the entry trigger can be immediate or CISD close-through. A quarter-pair panel controls which quarter relationships are evaluated, and an optional True-Open premium/discount gate is included (off by default).
TRUE OPENS
TMSO, TSO (session), TDO (daily), TWO (weekly), TMO (monthly), TQO (quarterly) and TYO (yearly) — each drawn from the true opening price of its cycle, on the chart timeframes where it is tradeable.
QUARTER LABELS
A label row names each timeframe's quarters — micro quarters on 1m, up through days, weeks, months, calendar quarters and years on higher charts. One label per window, centered in the window.
SIGNAL CONTROL
The Signals group shows exactly what you want and nothing more: SMT marks, entry marks, invalidation ✕, TS marks, forming marks, and whether scales above your HTF tier draw at all. Per-cycle and per-tier visibility switches are separate. An experimental time-based signal filter is included (off by default).
ALERTS
Four static alert conditions (SMT bearish/bullish, CISD entry bearish/bullish) plus detailed alert() payloads carrying the scale, pair, symbols and cause — create the alert with "Any alert() function call". Alerts can be scoped to one scale or all.
NOTES
Chart one of the triad symbols for the cleanest reading; with an inverse member in the triad (e.g., DXY), signal direction reads from the other two symbols.
Time anchors are New York based; built around futures sessions and also usable on FX, crypto and stocks.
The top-right readout always shows the active triad and configuration.
Educational tool for time-based market analysis — not financial advice.
What it deliberately does not contain: how divergence is judged inside the quarters, the pair semantics, the close/wick reference rule, the inverse-mirroring mechanics, and the experimental filter's rules — those stay only in your local repo docs. It names features (which anyone can see in the settings panel anyway) and explains usage, which is what TradingView moderators require for protected-source publications.
خلاصه: متن توضیحات برای انتشار در تریدینگویو آماده شد — فقط قابلیتها و طرز استفاده را میگوید، هیچ قاعدهای از منطق پشت ابزار لو نمیرود. متن در docs/tradingview-description.md ذخیره شده؛ کافی است همین را در صفحهی انتشار کپی کنی.Here's a publish-ready description — it presents the tool's features and how to use it, while keeping every proprietary rule out (consistent with the sanitized script). I'll save it in the repo docs too.
Saved to tradingview-description.md. Here's the text to paste into the TradingView publication:
QT_Mehr_Aria V5 — Quarterly Theory Cycles + Triad SMT
WHAT IT DOES
This indicator maps the market's time structure into nested cycles based on Quarterly Theory — from 22/23-minute micro cycles up to yearly and 4-year cycles — and scans a triad of three correlated instruments for SMT divergence at every scale. It draws cycle boundaries, quarter labels and True Opens, and prints signal and entry marks with configurable triggers and alerts.
CYCLES
Nine nested scales: Micro (22/23 min), 90-Minute, 6H, Daily, Weekly, Monthly, Quarterly, Yearly and 4-Year — all anchored to the New York 18:00 session open, DST-safe. On every chart timeframe the indicator works three tiers (LTF / MTF / HTF); higher scales can be shown optionally. Supported chart timeframes: 1m, 5m, 15m, 1h, 4h, Daily, Weekly and Monthly.
SMT DETECTION
Choose a triad preset (NQ/ES/YM · DXY/EU/GU · NQ/ES/NKD · BTC/ETH/SOL · DXY/6E/6B · GC/SI/HG · ZB/TN/ZF) or set three custom symbols. Each symbol is evaluated against its own reference level inside the cycle structure; when the triad disagrees, a divergence mark prints on the bar where it happened:
▽ bearish SMT · △ bullish SMT · ▼ / ▲ entry marks · ✕ invalidated signal · Ts true sweep (optional) · ▽? / △? forming on the live bar (optional)
Inverse-correlated triads (e.g., DXY against EU/GU) are handled automatically — custom triads get per-symbol inverse switches. Detection basis is selectable (wick, close, or wick+close confluence), and the entry trigger can be immediate or CISD close-through. A quarter-pair panel controls which quarter relationships are evaluated, and an optional True-Open premium/discount gate is included (off by default).
TRUE OPENS
TMSO, TSO (session), TDO (daily), TWO (weekly), TMO (monthly), TQO (quarterly) and TYO (yearly) — each drawn from the true opening price of its cycle, on the chart timeframes where it is tradeable.
QUARTER LABELS
A label row names each timeframe's quarters — micro quarters on 1m, up through days, weeks, months, calendar quarters and years on higher charts. One label per window, centered in the window.
SIGNAL CONTROL
The Signals group shows exactly what you want and nothing more: SMT marks, entry marks, invalidation ✕, TS marks, forming marks, and whether scales above your HTF tier draw at all. Per-cycle and per-tier visibility switches are separate. An experimental time-based signal filter is included (off by default).
ALERTS
Four static alert conditions (SMT bearish/bullish, CISD entry bearish/bullish) plus detailed alert() payloads carrying the scale, pair, symbols and cause — create the alert with "Any alert() function call". Alerts can be scoped to one scale or all.
NOTES
Chart one of the triad symbols for the cleanest reading; with an inverse member in the triad (e.g., DXY), signal direction reads from the other two symbols.
Time anchors are New York based; built around futures sessions and also usable on FX, crypto and stocks.
The top-right readout always shows the active triad and configuration.
Educational tool for time-based market analysis — not financial advice.
What it deliberately does not contain: how divergence is judged inside the quarters, the pair semantics, the close/wick reference rule, the inverse-mirroring mechanics, and the experimental filter's rules — those stay only in your local repo docs. It names features (which anyone can see in the settings panel anyway) and explains usage, which is what TradingView moderators require for protected-source publications.
Indikator

Indikator

RPFXBYDAN Liquidity Sweep Cascade [SMC]# Publication settings
**Publish this open-source, not invite-only/closed-source.** Every concept used here (liquidity sweeps, CISD, FVG, order blocks, kill zones, SMT divergence) is public-domain ICT/SMC terminology, not proprietary logic — TradingView's moderators specifically hold closed-source and invite-only scripts to a much higher bar (you have to justify what's unique enough to hide, and why it's worth paying for). Open-source sidesteps that requirement entirely and is the safer, more defensible choice for a script built from publicly-known building blocks combined in an original way.
# Title
RPFXBYDAN Liquidity Sweep Cascade
# Description
**Why these pieces are combined (not a mashup for its own sake)**
Each concept here exists to solve a specific failure mode of using it alone. A liquidity sweep by itself is noise — most swing highs/lows get taken out without reversing. Requiring a CISD (a shift in orderflow) after the sweep filters out sweeps that don't actually reverse. Requiring the entry to land inside a Fair Value Gap in the discount/premium half of the range filters out CISDs that reverse but leave a bad entry price. None of these three alone is a tradeable signal; the combination is the point.
The three-tier structure exists because a signal on one timeframe alone doesn't tell you if you're trading with or against the bigger picture. Tier 1 establishes the higher-timeframe liquidity/imbalance context. Tier 2 only starts hunting once Tier 1 completes, confirming the reaction on a mid-timeframe inside a session kill zone. Tier 3 only starts once Tier 2 completes, and is the only tier that produces a real stop/target — it's the culmination of the other two agreeing, not an independent signal. That sequential gating (each tier consumed by exactly one attempt from the tier above it) is the original mechanism in this script, not the individual concepts themselves.
SMT divergence and Inverse FVG tracking are optional add-ons layered on top of that same gated engine, off by default, for traders who already use those specific confluences.
**What this is**
A three-tier Smart Money Concepts checklist that only flags a setup once liquidity, structure, and risk all line up across three timeframes:
- **Tier 1 – HTF Context**: a higher-timeframe liquidity sweep reacting into an HTF imbalance (your Point of Interest).
- **Tier 2 – Mid Structure**: inside a session/kill-zone window, a mid-timeframe (default 15m) sweep, shift in orderflow (CISD), and Fair Value Gap / order block — only evaluated once Tier 1 has completed.
- **Tier 3 – Entry**: on your chart's own timeframe, a sweep, CISD, and FVG (or a confirmed Inverse FVG retest if no fresh FVG appears) — only evaluated once Tier 2 has completed. This is the only tier with a defined stop, a fixed R-multiple take-profit, and a Risk:Reward gate.
Optional confluence layers: SMT divergence against a correlated symbol (e.g. ES vs NQ), and an HTF directional bias readout.
A live table shows exactly which of the checklist items are satisfied, tier by tier, so you can see why a setup is or isn't "complete" instead of guessing.
**How to use it**
1. Set Tier 1's HTF input to something meaningfully higher than your chart (e.g. 4H/Daily if you trade 5m-15m).
2. Set Tier 2's mid-timeframe input (default 15m).
3. Enable the kill zone(s) you actually trade (New York AM is on by default).
4. Optionally set a correlated symbol for SMT divergence.
5. Watch the table: green checks across all three tiers plus R:R = a completed setup. Alerts fire automatically on completion (bullish and bearish are separate alert conditions).
**Limitations (read before trusting a green table)**
- This is a deterministic, rule-based approximation of a discretionary trading concept. Every judgment call in the code — how CISD is defined, where the 50% discount/premium line sits, how SMT divergence is measured — is this author's interpretation, not a universally agreed-upon standard.
- Higher-timeframe values only update when that HTF candle closes, by design, so they can lag price intentionally.
- Bar Replay does not render this script's drawings/table live (a TradingView platform limitation with drawing objects, not a bug in the script) — use a live or normal historical chart to watch it work.
- No indicator predicts the future. Backtest and forward-test on your own instrument and timeframe before risking real money. Nothing here is financial advice.
Indikator

ICT Fractal SMT Divergence Engine [v6]
ENGLISH
🔥 ICT Fractal SMT Divergence & Auto-Triad Engine is a professional, high-precision TradingView indicator designed for Smart Money Concepts (SMC) and Inner Circle Trader (ICT) methodology.
🎯 PURPOSE & CONCEPT
In institutional trading, SMT (Smart Money Technique) Divergence measures inter-market relative strength across correlated asset groups (Triads). When one asset in a triad sweeps liquidity by creating a new extreme ( Lower Low or Higher High ), while a correlated asset fails to sweep that extreme ( Higher Low or Lower High ), it reveals institutional accumulation/distribution and an imminent high-probability market reversal.
This indicator calculates SMT divergences strictly between confirmed Bill Williams / ICT Fractals , ensuring pixel-perfect visual precision on the chart with zero Y-axis displacement.
🧠 SMART AUTO-DETECT TRIAD ENGINE
The indicator automatically recognizes your current chart ticker and instantly pairs it with its exact correlated triad assets:
Crypto : Opening BTCUSDT.P, ETHUSDT.P, or any Altcoin automatically pairs BTCUSDT.P, ETHUSDT.P, and CRYPTOCAP:TOTAL3.
Forex : Opening EURUSD or GBPUSD automatically pairs the counterpart FX pair and DXY (with automatic inverse Dollar Index correlation).
Precious Metals : Opening XAUUSD (Gold) pairs XAGUSD (Silver) and PLATINUM. Opening XAGUSD pairs XAUUSD and PLATINUM.
US Stock Indices : Automatically correlates ES1! (S&P 500), NQ1! (Nasdaq), and YM1! (Dow Jones).
📖 HOW TO TRADE / USAGE RULES
Bullish SMT Setup (Long Bias) :
- Main asset breaks prior Fractal Low (Lower Low / Liquidity Sweep).
- Correlated triad asset holds its low (Higher Low).
- Execution: Look for bullish Market Structure Shift (MSS) or Fair Value Gap (FVG) entry.
Bearish SMT Setup (Short Bias) :
- Main asset breaks prior Fractal High (Higher High / Liquidity Sweep).
- Correlated triad asset holds its high (Lower High).
- Execution: Look for bearish Market Structure Shift (MSS) or Fair Value Gap (FVG) entry.
⚙️ COMPREHENSIVE SETTINGS & INPUTS EXPLANATION
Triad Preset Mode : Select between Auto Detect (Smart Triad), specific market presets, or Custom / Manual Tickers.
Asset 2 / Asset 3 Ticker (Custom) : Manual input for custom correlated assets when in Custom Mode.
Invert Asset 2 / Invert Asset 3 : Toggle for inversely correlated symbols (e.g., DXY vs EURUSD).
Fractal Length (Left/Right Bars) : Defines the fractal shoulder size (Default: 2 = classic 5-candle ICT Fractal).
Comparison Mode : Choose between Regular (High/Low wicks) or Hidden SMT (Close body prices).
Min / Max Distance (Bars) : Controls minimum and maximum bar separation between compared fractals.
Compare with Asset 2 / Compare with Asset 3 : Toggle individual asset divergence verification.
Visual Styling & HUD Dashboard : Customize colors, line thickness, label sizes, background glow, and dashboard HUD position.
Disclaimer: Trading financial markets involves substantial risk of loss. This indicator is designed for educational and analytical purposes to support SMC/ICT trading methodologies.
================================================================================
РУССКАЯ ВЕРСИЯ
🔥 ICT Fractal SMT Divergence & Auto-Triad Engine — это профессиональный высокоточный индикатор для трейдеров, торгующих по концепциям Smart Money Concepts (SMC / ICT) .
🎯 ПРЕДНАЗНАЧЕНИЕ И КОНЦЕПЦИЯ
В институциональном трейдинге SMT (Smart Money Technique) Дивергенция измеряет относительную силу между коррелирующими группами активов (Триадами). Когда один актив из триады обновляет ключевой ценовой уровень ( Lower Low или Higher High ), совершая снятие ликвидности (Liquidity Sweep) , а второй актив из триады отказывается обновлять свой экстремум (формируя Higher Low или Lower High ), это открывает институциональный след крупного игрока и указывает на скорый разворот рынка.
Индикатор строит дивергенции строго между подтвержденными фракталами Билла Вильямса / ICT , обеспечивая идеальную визуальную точность на графике без смещения меток по ценовой оси.
🧠 УМНЫЙ АВТО-ДЕТЕКТОР ТРИАД (SMART AUTO-DETECT)
Индикатор автоматически определяет открытый актив и мгновенно связывает его с правильной триадой:
Криптовалюта : При открытии BTCUSDT.P, ETHUSDT.P или любого альткоина автоматически подтягиваются коррелирующие активы: BTCUSDT.P, ETHUSDT.P и CRYPTOCAP:TOTAL3.
Валютные пары (Forex) : При открытии EURUSD или GBPUSD подтягивается парный валютный актив и DXY (с автоматической инверсией индекса доллара).
Драгоценные металлы : При открытии XAUUSD (Золото) автоматически подтягивается XAGUSD (Серебро) и PLATINUM. При открытии XAGUSD — XAUUSD и PLATINUM.
Фондовые индексы США : Автоматическое сравнение триады фьючерсов ES1! (S&P 500), NQ1! (Nasdaq) и YM1! (Dow Jones).
📖 РУКОВОДСТВО ПО ТОРГОВЛЕ И СИГНАЛЫ
Bullish SMT (Бычий SMT / Покупки) :
- Основной актив обновил предыдущий фрактальный лой (Lower Low / снял ликвидность).
- Коррелирующий актив из триады удержал лой (Higher Low).
- Вход в сделку: Ищите слом структуры (MSS / CHoCH) или имбаланс (FVG) на младшем таймфрейме для входа в лонг.
Bearish SMT (Медвежий SMT / Продажи) :
- Основной актив обновил предыдущий фрактальный хай (Higher High / снял ликвидность).
- Коррелирующий актив из триады удержал хай (Lower High).
- Вход в сделку: Ищите слом структуры (MSS / CHoCH) или имбаланс (FVG) на младшем таймфрейме для входа в шорт.
⚙️ ПОДРОБНЫЙ РАЗБОР ВСЕХ НАСТРОЕК
Triad Preset Mode : Выбор между Auto Detect (умное авто-определение), готовыми пресетами рынков или режимом Custom (ручной ввод).
Asset 2 / Asset 3 Ticker (Custom) : Поля для ручного ввода тикеров при включенном режиме Custom.
Invert Asset 2 / Invert Asset 3 : Включение инверсии для обратно коррелирующих активов (например, DXY против EURUSD).
Fractal Length (Left/Right Bars) : Размер плеча фрактала (по умолчанию 2 — классический 5-свечной фрактал ICT).
Comparison Mode : Режим сравнения: Regular SMT (сравнение по фитилям High/Low) или Hidden SMT (по закрытию тел Close).
Min / Max Distance (Bars) : Минимальное и максимальное расстояние в барах между сравниваемыми фракталами.
Compare with Asset 2 / Compare with Asset 3 : Включение/выключение проверки дивергенции по отдельным активам.
Visual Style & HUD Dashboard : Настройка цветов (Bull/Bear SMT), толщины линий, размера меток, подсветки фона и позиции таблицы на экране.
Отказ от ответственности: Торговля на финансовых рынках несет высокий риск. Данный индикатор создан для аналитических целей и поддержки решений по SMC / ICT концепциям. Indikator

AssetCorrelationUtilsAssetCorrelationUtils
Auto-detection library for correlated asset pairings across futures, CFD, and crypto markets. Given any chart, returns the correct secondary and tertiary (and optionally quaternary) tickers for multi-asset divergence analysis, along with inversion flags and asset-category metadata.
Designed to eliminate the boilerplate of hardcoded ticker lists and manual "if EURUSD then GBPUSD" branching in every indicator that needs correlated data.
What it does
Consumer scripts call one function — resolveCurrentChart() — and receive a fully resolved AssetConfig object describing the current chart's correlated pair or triad. The library handles:
Symbol root extraction from full ticker IDs (with expiry suffixes, exchange prefixes, micro variants)
Asset category routing (futures / CFD / crypto branches)
Family-specific triad or dyad selection
Inversion detection (e.g. 6C inverse of USDCAD, DXY inverse of EUR/GBP)
Futures session and back-adjustment modifiers
Optional GXT mode for metals (currency-cross triads on Gold/Silver)
Optional Quad mode for metals (four-leg configurations)
Micro contracts always resolve to their higher-volume full-size correlated partners — MNQ correlates against ES/YM, not MES/MYM — matching the "trade the micros, read the majors" convention.
Supported asset classes
Futures
Indices: NQ, ES, YM, RTY + micros (MNQ, MES, MYM, M2K)
Metals: GC, SI, HG + micros (MGC, SIL, MHG)
Forex: 6E, 6B, 6A, 6N, 6C + micros (M6E, M6B, M6A, M6C)
Energy: CL, RB, HO + micros (MCL, MRB, MHO)
Treasury: ZB, ZF, ZN
Crypto: BTC, ETH + micros (MBT, MET)
CFD / Spot
Forex: EURUSD, GBPUSD, DXY, USDJPY, USDCHF, USDCAD
Metals: XAUUSD, XAGUSD, COPPER + cross-pairs (XAUEUR, XAUGBP, XAGEUR, XAGGBP)
Indices: NAS100, SP500, DJ30
EU Stocks: GER40, EU50 (dyad only)
Crypto (spot / perp)
Major: BTC, ETH, SOL, XRP
Alt: ZEC, DOGE, ADA, BNB, TAO
All routed via BINANCE perpetual (.P) pairs for consistent OHLC quality
Core functions
resolveCurrentChart(gxtMode = false, quadMode = false)
The one-liner entry point for most consumers. Wraps resolveAssets() with sensible defaults (uses syminfo.ticker, syminfo.tickerid, syminfo.type, syminfo.session, back-adjustment on).
resolveAssets(ticker, tickerId, assetType, session, useBackadjust, gxtMode, quadMode)
The full-control entry point. Same detection logic, but with explicit control over back-adjustment and session modification — useful for indicators with a strategy toggle (e.g. RTH vs ETH sessions).
Category detectors
detectIndicesFutures(ticker)
detectMetalsFutures(ticker) / detectMetalsFuturesGxt(ticker) / detectMetalsFuturesQuad(ticker)
detectForexFutures(ticker) / detectCADFutures(ticker)
detectEnergyFutures(ticker)
detectTreasuryFutures(ticker)
detectCryptoFutures(ticker)
detectForexCFD(ticker, tickerId)
detectCrypto(ticker, tickerId)
detectMetalsCFD(ticker, tickerId) / detectMetalsCFDGxt(ticker, tickerId) / detectMetalsCFDQuad(ticker, tickerId)
detectIndicesCFD(ticker, tickerId)
detectEUStocks(ticker, tickerId)
Each returns an AssetPairing — usable directly if you want to bypass the automatic category routing.
Resolution helpers
resolveTriad(chartTickerId, pairing) — returns primary + secondary + tertiary with inversion flags
resolveDyad(chartTickerId, pairing) — returns primary + secondary for two-asset configs
resolveQuad(chartTickerId, pairing) — returns four-asset config with inversion flags
Utility functions
applySessionModifierWithBackadjust(ticker, session) / applySessionModifierNoBackadjust(ticker, session) — apply ticker.modify with back-adjustment on or off
isTriadMode(pairing) — check whether a pairing has a valid tertiary
getAssetTicker(tickerId) — extract the clean ticker string from a full ticker ID
Fallback
getDefaultFallback(tickerId) — returns a pairing with the chart ticker as primary and empty secondaries. Used automatically when no category matches.
Return types
AssetConfig
detected (bool) — true if the chart asset was recognized
isTriadMode (bool) — true if 3 assets resolved, false for dyad
isQuadMode (bool) — true if 4 assets resolved
primary (string) — resolved primary ticker ID
secondary (string) — resolved secondary ticker ID
tertiary (string) — resolved tertiary ticker ID (empty for dyad)
quaternary (string) — resolved quaternary ticker ID (empty unless quad mode)
invertSecondary (bool)
invertTertiary (bool)
invertQuaternary (bool)
assetCategory (string) — category tag (e.g. "index_futures", "metal_cfd_gxt")
AssetPairing
Internal pairing structure used by detector functions. Consumers rarely construct this directly, but resolveTriad / resolveDyad / resolveQuad accept it if you're bypassing the auto-routing.
Quick start
import I_quacker_I/AssetCorrelationUtils/7 as AC
AC.AssetConfig config = AC.resolveCurrentChart()
string secondary = config.secondary
string tertiary = config.tertiary
bool inv2 = config.invertSecondary
bool inv3 = config.invertTertiary
bool detected = config.detected
For metals with currency-cross triads:
AC.AssetConfig config = AC.resolveCurrentChart(true)
// On Gold: secondary = "FOREXCOM:XAUEUR", tertiary = "FOREXCOM:XAUGBP"
// On Copper or non-metals: identical to resolveCurrentChart(false)
Full integration patterns (Off / Auto / Manual tri-state, explicit back-adjust control, and manual pairing) are documented inline in the library source.
Design notes
Robust ticker matching. All detectors use str.contains() on the root symbol, so any ticker format is recognized — bare (NQ), continuous (NQ1!), or dated with expiry (NQZ2025). Exchange prefixes are ignored during detection.
Consistent inversion semantics. DXY as the third leg of USD-base forex triads is marked inverted (rises when the pair falls). 6C as USDCAD's futures counterpart is fully inverted. Micros carry their parent's inversion flags unchanged.
Category tags. Every resolved AssetConfig carries an assetCategory string ("index_futures", "metal_cfd_gxt", "crypto", "fallback", etc.). Useful for consumer scripts that want to conditionally enable features per category (e.g. "only compute GXT confluence on metals").
Fallback safety. When no category matches, the library returns the chart ticker as primary with empty secondary / tertiary, detected = false, and assetCategory = "fallback". Consumer scripts should check detected before assuming correlated data is available.
Credits
Original library concept — @fstarcapital
Modifications and extensions — @I_quacker_I
Crypto remapped to BINANCE .P perpetuals
Micro contracts always correlate against higher-volume mini/full contracts
AUD/NZD forex futures family (6A, M6A, 6N)
GXT mode for metals (currency-cross triads)
Quad mode for four-leg metal configurations
Crypto tertiary swapped from TOTAL3 (market-cap index, no clean OHLC) to XRP (tradeable asset with proper sweep behavior)
License: Mozilla Public License 2.0 Bibliothek

SMT Sniper Entry Engine [trade_w_samet]🎯 SMT Sniper Entry Engine
SMT Sniper Entry Engine is a structured correlated-market divergence and confirmation indicator designed to help traders study liquidity sweeps, SMT divergence, reclaim quality, pair correlation, external-range location, displacement, Fair Value Gap evidence, micro-structure confirmation, and permanent bar-close UP or DOWN signals through one coordinated workflow.
The script is built around one central idea:
An SMT divergence should not automatically become an entry signal.
Instead of treating every difference between two correlated markets as equally meaningful, the engine first identifies a one-market liquidity sweep, then evaluates reclaim behavior, ATR-normalized sweep depth, candle direction, rejection quality, range expansion, pair correlation, external-range location, and divergence separation before the SMT event is accepted.
A qualified SMT event still does not create an immediate final signal.
The accepted SMT event arms a temporary confirmation sequence.
The engine then waits for directional displacement, a confirmed break of the SMT candle, and the additional evidence required by the active Engine Preset before a permanent UP or DOWN label is printed.
The indicator includes:
• Automatic comparison-symbol selection for supported metals, indices, cryptocurrencies, forex majors, and common forex crosses
• Manual comparison-symbol mode
• Same-timeframe comparison-market data
• Closed-bar rolling liquidity references
• Current-bar-close SMT divergence detection
• Either-market sweep acceptance
• Same-bar liquidity reclaim validation
• ATR-normalized sweep-depth measurement
• Chart-candle direction filtering
• Rejection-close filtering
• Minimum range-expansion filtering
• Separate bullish and bearish 0–100 Base Quality Scores
• Log-return pair-correlation analysis
• External-range location filtering
• ATR-normalized divergence-separation analysis
• Separate bullish and bearish 0–100 Sniper Scores
• Standard, Sniper, and Elite Engine Presets
• A temporary eight-bar confirmation window
• Sequential evidence accumulation across separate closed candles
• Directional displacement confirmation
• SMT-candle break confirmation
• Fair Value Gap confirmation
• Micro-structure break confirmation
• ATR-buffered setup invalidation
• Setup expiration
• Directional SMT cooldown
• Final signal cooldown
• One final UP or DOWN signal per completed SMT sequence
• Minimal historical SMT markers
• Dotted historical SMT reference lines
• Blue UP and orange DOWN labels
• Adjustable UP / DOWN label size
• Signal-confirming FVG boxes
• Recent-only chart-object
• A premium bottom-right dashboard
• Static TradingView alert conditions
• Combined dynamic alert() support
• “Any alert() function call” compatibility
• Data Window diagnostics
• Confirmed-close permanent signals
• No pivot functions
• No future-bar confirmation
• No historical signal backplotting
The purpose of this script is to provide a structured way to study when a correlated-market divergence is supported by sufficient liquidity, correlation, location, reaction, and confirmation evidence.
It is not financial advice.
It is not an automated trading system.
It does not guarantee profitable trades.
It does not execute broker orders.
It does not calculate position size.
It does not include a built-in TP / SL trade-management engine.
It does not provide verified win-rate or profitability statistics.
It does not replace independent analysis, execution planning, or risk management.
━━━━━━━━━━━━━━━━━━━━━━
📌 OVERVIEW
━━━━━━━━━━━━━━━━━━━━━━
At a high level, SMT Sniper Entry Engine does the following:
• Selects a comparison market automatically or manually.
• Requests the comparison market’s open, high, low, close, and ATR data on the chart timeframe.
• Builds rolling liquidity references from already completed candles.
• Checks whether only one market swept its corresponding liquidity reference.
• Requires the sweeping market to reclaim the reference on the same completed candle.
• Measures sweep depth relative to ATR.
• Evaluates chart-candle direction.
• Evaluates the candle’s closing position.
• Evaluates minimum range expansion relative to ATR.
• Produces separate bullish and bearish 0–100 Base Quality Scores.
• Measures the relationship between chart and comparison-market returns.
• Evaluates whether bullish SMT appears near the lower portion of the external range.
• Evaluates whether bearish SMT appears near the upper portion of the external range.
• Measures how clearly the non-sweeping market held its own liquidity reference.
• Produces separate bullish and bearish 0–100 Sniper Scores.
• Applies Standard, Sniper, or Elite acceptance thresholds.
• Confirms a qualified SMT event only after the current candle closes.
• Arms a temporary sequential confirmation window.
• Accumulates displacement, SMT-candle break, FVG, and structure evidence.
• Invalidates the setup if price closes beyond the SMT extreme by the stored ATR buffer.
• Expires the setup when confirmation does not arrive inside the available window.
• Applies final signal cooldown protection.
• Prints a permanent blue UP or orange DOWN label only after every required condition is confirmed.
• Optionally draws the FVG associated with the final signal.
• Displays current engine state, comparison symbol, correlation, active score, and signal counts in the dashboard.
• Provides separate static alert conditions.
• Provides one combined dynamic final-signal alert workflow.
• Exposes internal diagnostic values through TradingView’s Data Window.
The indicator does not use machine-learning prediction.
Its scores are not probabilities.
Its signal counts are not wins and losses.
Its labels do not promise future direction.
The script is a rule-based educational framework that explains how a raw correlated-market divergence becomes an accepted, rejected, invalidated, expired, or finally confirmed setup.
━━━━━━━━━━━━━━━━━━━━━━
🧠 CORE IDEA
━━━━━━━━━━━━━━━━━━━━━━
The core idea behind SMT Sniper Entry Engine is that two markets with a meaningful positive relationship do not always take corresponding liquidity at the same time.
When one market trades beyond a prior liquidity reference while the other market holds its own reference, the difference can create an SMT divergence.
However, the divergence alone contains limited information.
A basic SMT event does not automatically explain:
• whether the sweep was meaningful relative to volatility
• whether the sweeping market reclaimed the reference
• whether the chart candle closed with directional rejection
• whether the candle range expanded enough to matter
• whether the selected markets remain sufficiently correlated
• whether the event occurred near a useful external-range location
• whether the non-sweeping market clearly held its own level
• whether price produced directional displacement afterward
• whether the SMT candle was actually broken
• whether an FVG or micro-structure break confirmed the reaction
• whether the setup remained valid during the confirmation window
• whether another recent final signal is still inside the cooldown period
The engine therefore uses a staged sequence:
comparison-market selection
→ closed-bar liquidity references
→ one-market sweep
→ same-bar reclaim
→ Base Quality Score
→ pair-correlation validation
→ external-range location
→ divergence-separation validation
→ Sniper Score
→ confirmed SMT event
→ temporary setup arming
→ sequential reaction evidence
→ invalidation or expiration control
→ permanent UP or DOWN signal
For bullish conditions, the engine studies prior-low liquidity, bullish rejection, lower external-range location, directional displacement, a close above the SMT candle high, and bullish confirmation evidence.
For bearish conditions, the same process is mirrored around prior highs.
The purpose is not to produce the largest possible number of signals.
The purpose is to make the acceptance process selective, visible, and understandable.
━━━━━━━━━━━━━━━━━━━━━━
🧩 WHY THIS SCRIPT IS NOT A SIMPLE BUY/SELL INDICATOR
━━━━━━━━━━━━━━━━━━━━━━
SMT Sniper Entry Engine is not designed to be used as a blind signal generator.
A raw correlated-market divergence must move through multiple stages:
One market sweeps liquidity
→ the comparison market does not make the same sweep
→ the sweeping market reclaims its reference
→ sweep depth is evaluated
→ chart-candle direction is checked
→ rejection-close quality is checked
→ range expansion is checked
→ the Base Quality Score is calculated
→ pair correlation is checked
→ external-range location is checked
→ divergence separation is checked
→ the Sniper Score is calculated
→ the SMT event is accepted
→ the confirmation window opens
→ directional displacement is accumulated
→ the SMT candle must be broken
→ FVG and/or micro-structure evidence is accumulated
→ the setup must avoid invalidation
→ the setup must confirm before expiration
→ the final UP or DOWN label appears
Each module serves a different purpose.
The comparison engine defines the external market used for SMT analysis.
The liquidity engine identifies the one-market sweep.
The reclaim engine checks whether the liquidity event closed back inside the reference.
The Base Quality Score evaluates the completed SMT candle.
The Sniper Context Engine evaluates correlation, location, separation, and sweep quality.
The sequential confirmation engine evaluates what price does after the SMT event.
The invalidation and expiration controls remove setups that no longer satisfy the intended sequence.
The dashboard explains the current engine state.
This makes the script a coordinated SMT-confirmation workflow rather than a simple divergence marker.
━━━━━━━━━━━━━━━━━━━━━━
⚙️ HOW THE SCRIPT WORKS
━━━━━━━━━━━━━━━━━━━━━━
The script operates through connected calculation stages.
First, the engine selects a comparison symbol.
Auto mode uses the built-in symbol matrix.
Manual mode uses the symbol selected by the user.
The comparison market is requested on the same timeframe as the chart.
= request.security(
comparisonSymbol,
timeframe.period,
,
gaps = barmerge.gaps_off,
lookahead = barmerge.lookahead_off,
ignore_invalid_symbol = true)
The request uses lookahead_off.
The engine then calculates rolling chart and comparison-market liquidity references while excluding the current candle.
float chartPriorLow = ta.lowest(low , referenceLookback)
float chartPriorHigh = ta.highest(high , referenceLookback)
float comparisonPriorLow = ta.lowest(comparisonLow , referenceLookback)
float comparisonPriorHigh = ta.highest(comparisonHigh , referenceLookback)
The default reference lookback is 12 bars.
A bullish divergence is possible when one market sweeps a prior low and the other market does not.
A bearish divergence is possible when one market sweeps a prior high and the other market does not.
The sweeping market must reclaim the level on the same completed candle.
The candidate is then evaluated through:
• ATR-normalized sweep depth
• chart-candle direction
• close location
• range expansion
• Base Quality Score
• pair correlation
• external-range location
• divergence separation
• Sniper Score
• directional cooldown
When the SMT event is accepted, the engine stores:
• setup direction
• SMT bar
• SMT extreme
• SMT reaction trigger
• current ATR
• Base Quality Score
• Sniper Score
• sequential evidence states
• first confirmed FVG coordinates
The engine then monitors the next closed candles.
A final signal is accepted only when the active preset’s required evidence is present and the setup has not invalidated or expired.
━━━━━━━━━━━━━━━━━━━━━━
🟢 BULLISH SMT LOGIC
━━━━━━━━━━━━━━━━━━━━━━
A bullish SMT candidate begins at prior lows.
The engine checks the chart symbol and comparison market together.
A bullish sweep divergence exists when either:
• the chart symbol trades below its prior low while the comparison market does not trade below its corresponding prior low
• the comparison market trades below its prior low while the chart symbol does not trade below its corresponding prior low
The engine accepts a sweep from either market.
The sweeping market must reclaim the prior-low reference when reclaim validation is active.
The completed chart candle must also satisfy the active quality requirements.
The default Sniper profile evaluates:
• sufficient ATR-normalized sweep depth
• bullish chart-candle direction
• a close in the stronger portion of the candle
• minimum candle-range expansion
• minimum Base Quality Score
• minimum positive pair correlation
• location near the lower portion of the external range
• minimum divergence separation
• minimum Sniper Score
• directional SMT cooldown availability
bool bullishSmtEvent =
bullishRawSmtCandidate and
bullishSniperPass and
bullishCooldownPass
When the bullish SMT event is confirmed, the engine stores:
• the SMT low as the bullish invalidation extreme
• the SMT high as the bullish reaction-break trigger
• the current ATR
• the current Base Quality Score
• the current Sniper Score
The confirmation sequence then waits for:
• bullish displacement
• a close above the SMT candle high
• FVG and/or micro-structure evidence according to the active preset
The bullish SMT marker is context.
The final blue UP label is the completed signal.
━━━━━━━━━━━━━━━━━━━━━━
🔴 BEARISH SMT LOGIC
━━━━━━━━━━━━━━━━━━━━━━
A bearish SMT candidate begins at prior highs.
A bearish sweep divergence exists when either:
• the chart symbol trades above its prior high while the comparison market does not trade above its corresponding prior high
• the comparison market trades above its prior high while the chart symbol does not trade above its corresponding prior high
The sweeping market must reclaim the prior-high reference when reclaim validation is active.
The completed chart candle must also satisfy the active quality requirements.
The default Sniper profile evaluates:
• sufficient ATR-normalized sweep depth
• bearish chart-candle direction
• a close in the weaker portion of the candle
• minimum candle-range expansion
• minimum Base Quality Score
• minimum positive pair correlation
• location near the upper portion of the external range
• minimum divergence separation
• minimum Sniper Score
• directional SMT cooldown availability
When the bearish SMT event is confirmed, the engine stores:
• the SMT high as the bearish invalidation extreme
• the SMT low as the bearish reaction-break trigger
• the current ATR
• the current Base Quality Score
• the current Sniper Score
The confirmation sequence then waits for:
• bearish displacement
• a close below the SMT candle low
• FVG and/or micro-structure evidence according to the active preset
The bearish SMT marker is context.
The final orange DOWN label is the completed signal.
━━━━━━━━━━━━━━━━━━━━━━
💎 SMT QUALITY FILTER SYSTEM
━━━━━━━━━━━━━━━━━━━━━━
The script calculates separate bullish and bearish Base Quality Scores.
The score evaluates the completed SMT candle and its underlying liquidity event.
Each score is limited to 0–100.
The components are:
Sweep Role — maximum 25 points
The event must contain a valid one-market liquidity sweep.
Only one market should take the corresponding prior high or prior low.
Reclaim — maximum 20 points
The sweeping market must close back inside its prior liquidity reference.
Sweep Depth — maximum 20 points
The distance beyond the reference is measured relative to the corresponding market’s ATR.
Chart Candle Direction — maximum 15 points
Bullish SMT prefers a bullish chart candle.
Bearish SMT prefers a bearish chart candle.
Rejection Close — maximum 10 points
Bullish SMT prefers the chart close toward the high of the candle.
Bearish SMT prefers the chart close toward the low.
Range Expansion — maximum 10 points
The chart candle’s total range is compared with chart ATR.
The total score structure is:
25 + 20 + 20 + 15 + 10 + 10 = 100 points.
Preset-dependent minimum Base Quality Scores are:
• Standard: 60
• Sniper: 75
• Elite: 85
The Base Quality Score is not a win rate.
It is not a probability.
It measures how closely the completed SMT event matches the engine’s liquidity and candle-quality framework.
━━━━━━━━━━━━━━━━━━━━━━
📏 VOLATILITY / ATR NORMALIZATION FILTER
━━━━━━━━━━━━━━━━━━━━━━
The indicator uses ATR normalization to compare distances across changing volatility conditions.
ATR normalization is applied to:
• chart-side sweep depth
• comparison-side sweep depth
• divergence separation
• displacement body size
• setup invalidation buffer
• chart-candle range expansion
Sweep depth is calculated in relation to the ATR of the market that performed the sweep.
For example:
Chart Sweep Depth = distance beyond chart reference / chart ATR.
Comparison Sweep Depth = distance beyond comparison reference / comparison ATR.
Preset-dependent minimum sweep depth is:
• Standard: 0.04 ATR
• Sniper: 0.10 ATR
• Elite: 0.18 ATR
The chart candle must also meet a minimum range-to-ATR requirement:
• Standard: 0.40 ATR
• Sniper: 0.60 ATR
• Elite: 0.85 ATR
The setup invalidation buffer is based on the ATR stored when the SMT event occurs.
The default buffer is 0.10 ATR beyond the SMT extreme.
ATR normalization helps reduce dependence on raw price units.
It does not make one configuration universal.
Different symbols, sessions, data feeds, and market conditions can still produce different behavior.
━━━━━━━━━━━━━━━━━━━━━━
🕯️ DISPLACEMENT QUALITY FILTER
━━━━━━━━━━━━━━━━━━━━━━
After an SMT event is accepted, the engine requires directional displacement before a final signal can appear.
A bullish displacement candle requires:
• a confirmed closed candle
• close above open
• body size of at least 0.45 ATR
• body-to-range ratio of at least 0.55
• upper wick no greater than 0.35 of the full candle range
A bearish displacement candle requires:
• a confirmed closed candle
• close below open
• body size of at least 0.45 ATR
• body-to-range ratio of at least 0.55
• lower wick no greater than 0.35 of the full candle range
bool bullishDisplacement =
barstate.isconfirmed and
close > open and
signalCandleBody >= chartAtr * displacementBodyAtr and
signalBodyRatio >= displacementBodyPercent and
bullishOppositeWickRatio <= maximumOppositeWickPercent and
bullishPreviousBreakPass
The bearish process is mirrored.
The previous-bar break option is disabled in the locked default engine.
The more important directional reaction requirement is the SMT-candle break.
Displacement confirms that the market produced a completed directional response after the SMT event.
It does not guarantee continuation.
━━━━━━━━━━━━━━━━━━━━━━
📊 REACTION STRENGTH FILTER
━━━━━━━━━━━━━━━━━━━━━━
The engine does not require every confirmation component to appear on the same candle.
Instead, reaction evidence can accumulate across separate closed candles inside the temporary confirmation window.
The engine tracks:
• displacement
• SMT-candle break
• Fair Value Gap
• micro-structure break
Bullish SMT-candle break:
• price must close above the stored SMT candle high
Bearish SMT-candle break:
• price must close below the stored SMT candle low
Bullish FVG:
• current low is above the high from two bars earlier
Bearish FVG:
• current high is below the low from two bars earlier
Bullish micro-structure break:
• current close exceeds the highest high from the previous five closed bars
Bearish micro-structure break:
• current close falls below the lowest low from the previous five closed bars
Evidence is persistent while the setup remains active.
For example:
SMT event
→ displacement appears
→ FVG appears later
→ structure break appears on another candle
→ final signal confirms
The active Engine Preset determines which accumulated evidence is required.
━━━━━━━━━━━━━━━━━━━━━━
🧼 CONFIRMED SIGNAL FILTER
━━━━━━━━━━━━━━━━━━━━━━
Permanent SMT events and final UP / DOWN labels wait for candle close.
The engine uses confirmed-bar checks for:
• raw SMT candidates
• final SMT acceptance
• displacement
• FVG detection
• micro-structure breaks
• setup invalidation
• final UP signals
• final DOWN signals
The comparison-market request uses lookahead_off.
Rolling liquidity references exclude the current candle.
No future candle is used to decide whether the current candle contains an SMT event.
No final signal is plotted back onto the original SMT candle after later evidence becomes available.
The confirmation opportunity is temporary.
The default window is eight bars.
The minimum delay is one bar after the SMT event.
If the active evidence does not complete in time, the setup expires.
Historical output can still change when:
• Engine Preset changes
• comparison symbol changes
• Auto or Manual mode changes
• chart symbol changes
• timeframe changes
• exchange or broker feed changes
• historical data is revised
• the loaded history range changes
Confirmed-close logic prevents unfinished-candle conditions from becoming permanent chart signals.
It does not mean all brokers or data feeds will produce identical historical output.
━━━━━━━━━━━━━━━━━━━━━━
🎯 ENTRY MODEL
━━━━━━━━━━━━━━━━━━━━━━
SMT Sniper Entry Engine uses a confirmed-signal entry model rather than a built-in broker-order model.
A final directional setup is created only when:
• a qualified SMT event exists
• the confirmation window is open
• the setup has not invalidated
• all preset-required evidence has been accumulated
• final signal cooldown is available
• the current candle is confirmed
The final signal reference is the close of the candle where the UP or DOWN label is printed.
For an UP setup:
• the label appears below the confirmed signal candle
• the signal represents completed bullish SMT confirmation
For a DOWN setup:
• the label appears above the confirmed signal candle
• the signal represents completed bearish SMT confirmation
The script does not automatically calculate:
• an entry line
• a stop-loss level
• take-profit targets
• position size
• account risk
• broker quantity
• trade outcome
The final signal-bar close can be used as an analytical reference.
It is not a guaranteed fill.
Users must define their own execution, invalidation, stop, target, and risk model.
━━━━━━━━━━━━━━━━━━━━━━
🔗 COMPARISON MARKET MODEL
━━━━━━━━━━━━━━━━━━━━━━
The indicator supports Auto and Manual comparison-symbol modes.
Auto mode recognizes common ticker text and assigns a predefined positively related market.
Built-in mappings include:
Metals
• XAU or GOLD → OANDA:XAGUSD
• XAG or SILVER → OANDA:XAUUSD
Indices
• NAS, US100, USTEC, NDX, or NQ → OANDA:SPX500USD
• SPX, US500, SP500, or ES → OANDA:NAS100USD
• US30, DJI, DOW, or YM → OANDA:SPX500USD
Cryptocurrencies
• BTC → BINANCE:ETHUSDT
• ETH → BINANCE:BTCUSDT
Forex majors
• EURUSD ↔ GBPUSD
• AUDUSD ↔ NZDUSD
• USDCAD ↔ USDCHF
• USDJPY → CADJPY
JPY crosses
• EURJPY ↔ GBPJPY
• AUDJPY ↔ NZDJPY
• CADJPY → USDJPY
• CHFJPY → EURJPY
EUR and GBP crosses
• EURAUD ↔ GBPAUD
• EURNZD ↔ GBPNZD
• EURCAD ↔ GBPCAD
• EURCHF ↔ GBPCHF
• EURGBP → GBPUSD
AUD and NZD crosses
• AUDCAD ↔ NZDCAD
• AUDCHF ↔ NZDCHF
• AUDNZD → NZDUSD
Auto mode is based on ticker-name recognition.
Broker symbols can include prefixes, suffixes, futures contract codes, or synthetic names that are not recognized by the built-in matrix.
When the chart symbol is not recognized, the engine can fall back to the Manual Comparison Symbol value.
The dashboard should therefore be checked before relying on Auto mode.
Manual mode allows the user to select the comparison market directly.
The current engine is designed for positively correlated relationships.
Selecting an inversely related market can make the correlation and SMT logic unsuitable.
━━━━━━━━━━━━━━━━━━━━━━
🎯 SNIPER SCORE MODEL
━━━━━━━━━━━━━━━━━━━━━━
The engine produces separate bullish and bearish Sniper Scores.
The Sniper Score evaluates broader context around the SMT event.
The maximum score is 100.
The structure is:
Base SMT Quality — maximum 35 points
The 0–100 Base Quality Score contributes 35% of its value.
Pair Correlation — maximum 25 points
Positive effective correlation contributes proportionally.
External-Range Location — maximum 20 points
Bullish SMT receives this component when it occurs below the active maximum bullish range position.
Bearish SMT receives this component when it occurs above the active minimum bearish range position.
Divergence Separation — maximum 10 points
The event receives this component when the non-sweeping market holds its reference by at least the required ATR-normalized distance.
Sweep Depth — maximum 10 points
A valid minimum sweep receives five points.
A sweep at least 1.5 times the minimum depth receives ten points.
Minimum accepted Sniper Scores are:
• Standard: 60
• Sniper: 78
• Elite: 88
Minimum positive pair correlation is:
• Standard: 0.35
• Sniper: 0.55
• Elite: 0.70
External-range requirements are:
Bullish maximum position
• Standard: 0.45
• Sniper: 0.33
• Elite: 0.25
Bearish minimum position
• Standard: 0.55
• Sniper: 0.67
• Elite: 0.75
Minimum divergence separation is:
• Standard: 0.00 ATR
• Sniper: 0.03 ATR
• Elite: 0.08 ATR
The Sniper Score is not a probability.
A score of 88 does not mean an 88% probability of success.
It measures rule-based confluence according to this script’s internal framework.
━━━━━━━━━━━━━━━━━━━━━━
📦 ACTIVE SMT / FVG VISUAL SYSTEM
━━━━━━━━━━━━━━━━━━━━━━
The script separates SMT context from final signal confirmation.
Historical SMT visuals can include:
• a dotted line from the prior chart-side liquidity reference to the SMT candle
• a minimal bullish or bearish marker near the SMT event
The default historical visual system keeps recent objects only.
The default limits are:
• eight bullish SMT lines
• eight bullish SMT markers
• eight bearish SMT lines
• eight bearish SMT markers
• ten final signal labels
• six signal FVG boxes
Older visual objects can be removed when the corresponding recent-only limit is exceeded.
This is chart-object management.
It does not move a signal to another candle.
Final signal visuals include:
UP
• blue label
• white bold-italic text
• printed below the confirmed signal candle
DOWN
• orange label
• white bold-italic text
• printed above the confirmed signal candle
Signal FVG Box
• appears only when stored FVG evidence exists
• uses the FVG that participated in the active confirmation sequence
• extends 12 bars to the right
• uses a lightly shaded bullish or bearish fill
The FVG box is an analytical confirmation visual.
It is not a guaranteed support, resistance, entry, stop, or target zone.
━━━━━━━━━━━━━━━━━━━━━━
🚦 ONE ACTIVE SMT SETUP AT A TIME
━━━━━━━━━━━━━━━━━━━━━━
The script maintains one active pending SMT confirmation sequence at a time.
When a qualified bullish SMT event appears:
• the active setup direction becomes bullish
• the bullish SMT extreme and trigger are stored
• the evidence state is reset
When a qualified bearish SMT event appears:
• the active setup direction becomes bearish
• the bearish SMT extreme and trigger are stored
• the evidence state is reset
A newly accepted SMT event can therefore replace the currently stored pending setup state.
The active setup remains in memory until:
• the final UP signal confirms
• the final DOWN signal confirms
• the setup invalidates
• the setup expires
• another accepted SMT event overwrites the pending state
This design prevents multiple overlapping confirmation sequences from creating an unclear chart state.
It does not prevent the user from performing independent analysis on other markets or timeframes.
━━━━━━━━━━━━━━━━━━━━━━
⚠️ SEQUENTIAL CONFIRMATION WINDOW HANDLING
━━━━━━━━━━━━━━━━━━━━━━
The default confirmation window is eight bars.
The final signal cannot appear on the original SMT candle because the minimum bars after SMT is one.
The engine monitors each completed candle inside the window.
Evidence can be accumulated in different orders.
For example:
SMT
→ displacement
→ SMT-candle break
→ FVG
→ final signal
or:
SMT
→ FVG
→ displacement
→ SMT-candle break
→ structure break
→ final signal
Preset behavior:
Standard
Uses Reactive confirmation.
Requires:
• displacement
• SMT-candle break
Sniper
Uses Confirmed confirmation.
Requires:
• displacement
• SMT-candle break
• FVG or micro-structure break
Elite
Uses Elite confirmation.
Requires:
• displacement
• SMT-candle break
• FVG
• micro-structure break
The engine does not use the historical high-low sequence inside a candle to simulate order execution.
It evaluates whether each closed candle satisfied a defined piece of evidence.
If the setup does not complete inside the window, it expires.
━━━━━━━━━━━━━━━━━━━━━━
🏷️ SMT SNIPER LABELS
━━━━━━━━━━━━━━━━━━━━━━
The indicator uses separate context and final-signal labels.
SMT Context Markers
The default SMT marker layout is Minimal.
Bullish SMT uses an upward marker.
Bearish SMT uses a downward marker.
The marker appears on the actual SMT confirmation candle.
Its tooltip can include:
• bullish or bearish SMT direction
• Sniper Score
• Base Quality Score
• effective pair correlation
• active comparison symbol
Final Signal Labels
The final labels display:
𝙐𝙋
or:
𝘿𝙊𝙒𝙉
UP uses a blue background.
DOWN uses an orange background.
The text is white.
Available final-label sizes are:
• Tiny
• Small
• Normal
• Large
• Huge
Normal is the default.
The UP tooltip can include:
• bullish SMT confirmation mode
• final stored Sniper Score
• final stored Base Quality Score
The DOWN tooltip contains the mirrored information.
The SMT marker and final signal label serve different purposes.
The SMT marker identifies the qualified correlated-market divergence.
The UP or DOWN label identifies the completed sequential confirmation.
━━━━━━━━━━━━━━━━━━━━━━
📍 SMT DISPLAY MODES
━━━━━━━━━━━━━━━━━━━━━━
The indicator operates directly on the main price chart.
The public Display settings provide control over:
Show SMT
Shows or hides historical SMT markers and reference lines.
Show UP / DOWN
Shows or hides final signal labels.
UP / DOWN Label Size
Controls the size of final UP and DOWN labels.
Show Signal FVG
Shows or hides the stored FVG box associated with a final signal.
Show Dashboard
Shows or hides the premium bottom-right dashboard.
The internal visual profile uses:
• Clean layout
• Recent Only historical display
• dotted SMT reference lines
• minimal SMT markers
• normal SMT marker size
• limited historical object counts
• no separate displacement circles by default
Input values are hidden from TradingView’s status line.
Diagnostic plots remain available in the Data Window without adding visible price-scale clutter.
━━━━━━━━━━━━━━━━━━━━━━
🧹 SETUP INVALIDATION
━━━━━━━━━━━━━━━━━━━━━━
Not every accepted SMT event remains eligible.
A bullish setup invalidates when a completed candle closes below:
SMT low − stored SMT ATR × 0.10.
A bearish setup invalidates when a completed candle closes above:
SMT high + stored SMT ATR × 0.10.
The ATR value is stored when the SMT event appears.
This keeps the invalidation buffer linked to the volatility present when the setup was created.
A setup can also fail to produce a final signal because:
• the confirmation window expires
• displacement never appears
• the SMT candle is not broken
• required FVG evidence does not appear
• required structure evidence does not appear
• the final signal cooldown is active
• a newly accepted SMT event replaces the pending state
The directional SMT cooldown is 15 bars.
The final signal cooldown is eight bars.
A rejected, invalidated, or expired pending sequence does not print a final UP or DOWN label.
━━━━━━━━━━━━━━━━━━━━━━
📟 DASHBOARD
━━━━━━━━━━━━━━━━━━━━━━
The indicator includes a premium dashboard in the bottom-right corner of the chart.
The header displays:
trade_w_samet • SMT SNIPER
Current State
Possible states include:
• SCANNING MARKET
• BULLISH SMT DETECTED
• BEARISH SMT DETECTED
• BULLISH SETUP BUILDING
• BEARISH SETUP BUILDING
• UP SIGNAL CONFIRMED
• DOWN SIGNAL CONFIRMED
Comparison
Displays the active comparison symbol.
Correlation
Displays the current effective pair correlation.
Engine
Displays:
• STANDARD
• SNIPER
• ELITE
Pair Mode
Displays:
• AUTO
• MANUAL
Signal Score
When a relevant setup is active, the dashboard displays:
current Sniper Score / required Sniper Score.
When no setup is active, it displays:
NO ACTIVE SETUP.
UP / DOWN Counts
Displays the number of final confirmed UP and DOWN signals calculated on the loaded chart history.
Footer
Displays:
• BAR-CLOSE
• NON-REPAINT
• LIVE
The dashboard is not TradingView Strategy Tester.
It does not display:
• win rate
• profit factor
• expectancy
• drawdown
• net profit
• broker-verified results
UP and DOWN counts are signal counts only.
“LIVE” means the dashboard updates with the latest available script state.
It does not mean the script predicts unfinished intrabar outcomes.
━━━━━━━━━━━━━━━━━━━━━━
🚨 ALERT SYSTEM
━━━━━━━━━━━━━━━━━━━━━━
SMT Sniper Entry Engine includes static TradingView alert conditions for:
• Bullish SMT
• Bearish SMT
• UP
• DOWN
• Any Signal
• Any SMT
Bullish SMT
Triggers when a bullish SMT event passes the complete Base Quality and Sniper acceptance process.
Bearish SMT
Triggers when a bearish SMT event passes the mirrored acceptance process.
UP
Triggers when the bullish sequential confirmation process is complete.
DOWN
Triggers when the bearish sequential confirmation process is complete.
Any Signal
Combines final UP and DOWN conditions.
Any SMT
Combines bullish and bearish SMT conditions.
The script also includes dynamic alert() messages for final UP and DOWN signals.
Dynamic messages can include:
• product name
• direction
• chart ticker
• chart timeframe
• confirmed close price
• active comparison symbol
if enableAlerts
if buySignal
alert(
"SMT Sniper | UP | " +
syminfo.ticker +
" | " +
timeframe.period +
" | Close: " +
str.tostring(close, format.mintick) +
" | Comparison: " +
comparisonSymbol,
alert.freq_once_per_bar_close)
The DOWN dynamic message uses the mirrored format.
Dynamic final-signal alerts use once-per-bar-close frequency.
Alerts are monitoring tools.
They do not place, modify, or close broker orders.
━━━━━━━━━━━━━━━━━━━━━━
🔔 HOW TO USE ALERTS
━━━━━━━━━━━━━━━━━━━━━━
For separate static conditions:
1. Add SMT Sniper Entry Engine to the chart.
2. Open TradingView’s Create Alert window.
3. Select SMT Sniper as the condition.
4. Choose Bullish SMT, Bearish SMT, UP, DOWN, Any Signal, or Any SMT.
5. Select the desired notification method.
6. Use a confirmed-bar frequency where appropriate.
7. Test the alert before relying on it.
For one combined dynamic final-signal alert:
1. Enable Alerts in the indicator settings.
2. Open TradingView’s Create Alert window.
3. Select SMT Sniper.
4. Select Any alert() function call.
5. Configure the delivery method.
6. Test the UP and DOWN message format.
The combined dynamic alert sends final UP and DOWN events through one TradingView alert.
Static Any Signal also combines UP and DOWN conditions, but uses the static alertcondition() message.
When indicator settings, code, symbol, or timeframe are materially changed, an already-created TradingView alert can continue using the script snapshot stored when that alert was created.
Recreate alerts after important configuration changes.
Alert delivery can depend on:
• TradingView servers
• selected symbol
• selected timeframe
• market-data availability
• realtime feed status
• symbol session
• user alert configuration
• webhook or external-service availability
Creating an alert does not guarantee broker execution.
━━━━━━━━━━━━━━━━━━━━━━
🧪 HOW TO USE THE INDICATOR
━━━━━━━━━━━━━━━━━━━━━━
A practical workflow:
1. Add SMT Sniper Entry Engine to a standard candlestick chart.
2. Begin with Engine Preset set to Sniper.
3. Keep Comparison Symbol Mode on Auto for supported symbols.
4. Review the Comparison field in the dashboard.
5. If the automatic market is not appropriate, switch to Manual.
6. Select a positively related comparison market.
7. Keep Show SMT enabled while learning the setup sequence.
8. Observe the historical liquidity reference line.
9. Observe the minimal SMT marker.
10. Treat the SMT marker as context, not as the final signal.
11. Watch the dashboard state.
12. Wait for a blue UP or orange DOWN label.
13. Review the active Sniper Score and required threshold.
14. Review the correlation value.
15. Review the signal FVG box when one is available.
16. Use alerts for monitoring rather than blind execution.
17. Evaluate broader market structure independently.
18. Review session conditions, volatility, spread, and news risk.
19. Define personal entry, invalidation, stop, target, and position-size rules.
20. Test the exact symbol, timeframe, exchange, broker feed, and comparison pair personally used.
The indicator is designed for structured review.
It should not be treated as an automatic decision-maker.
━━━━━━━━━━━━━━━━━━━━━━
⚙️ SETTINGS REFERENCE
━━━━━━━━━━━━━━━━━━━━━━
The public settings menu is intentionally simplified.
Advanced thresholds remain locked inside the engine to reduce configuration clutter and preserve consistent preset behavior.
⚙️ Engine
Engine Preset
Selects:
• Standard
• Sniper
• Elite
Standard
Produces more accepted setups.
Uses Balanced Base Quality, Standard Sniper thresholds, and Reactive confirmation.
Sniper
The default profile.
Uses Strict Base Quality, Sniper context thresholds, and Confirmed evidence requirements.
Elite
The most selective profile.
Uses Elite Base Quality, Elite context thresholds, and the strictest sequential evidence requirement.
A stricter preset does not guarantee better trading results.
━━━━━━━━━━━━━━━━━━━━━━
🔗 Comparison Market
Comparison Symbol Mode
Auto
Uses the internal ticker-recognition matrix.
Manual
Uses the selected Manual Comparison Symbol.
Manual Comparison Symbol
Selects the external market used by the SMT engine.
This field is active only when Comparison Symbol Mode is Manual.
Use a positively related comparison market.
━━━━━━━━━━━━━━━━━━━━━━
🎨 Display
Show SMT
Shows or hides historical SMT reference lines and markers.
Show UP / DOWN
Shows or hides final signal labels.
UP / DOWN Label Size
Selects:
• Tiny
• Small
• Normal
• Large
• Huge
Normal is the default.
Show Signal FVG
Shows or hides the stored FVG box associated with a final signal.
Show Dashboard
Shows or hides the bottom-right premium dashboard.
━━━━━━━━━━━━━━━━━━━━━━
🔔 Alerts
Enable Alerts
Enables the script’s static alert conditions and dynamic alert() calls.
For one combined runtime UP / DOWN alert, create the TradingView alert using:
Any alert() function call.
All public input values use hidden status-line display.
Diagnostic values remain available through TradingView’s Data Window.
━━━━━━━━━━━━━━━━━━━━━━
🧠 WHAT MAKES THIS SCRIPT ORIGINAL
━━━━━━━━━━━━━━━━━━━━━━
SMT divergence, liquidity sweeps, correlation, ATR, Fair Value Gaps, and structure breaks are familiar technical-analysis concepts.
These concepts are not unique by themselves.
The originality of SMT Sniper Entry Engine lies in the coordinated process applied to them:
automatic comparison-market selection
→ closed-bar rolling liquidity references
→ one-market liquidity sweep
→ same-bar reclaim
→ ATR-normalized Base Quality Score
→ log-return pair correlation
→ external-range location
→ ATR-normalized divergence separation
→ 0–100 Sniper Score
→ preset-driven SMT acceptance
→ temporary sequential confirmation
→ displacement evidence
→ SMT-candle break
→ FVG and micro-structure evidence
→ ATR-buffered invalidation
→ setup expiration
→ permanent UP or DOWN signal
→ recent-only visual management
→ static and dynamic alerts
→ premium diagnostic dashboard
Distinctive implementation features include:
• accepting a valid sweep from either market
• using rolling closed-bar references instead of pivot confirmation
• separating the SMT event from the final signal
• calculating separate Base Quality and Sniper Scores
• requiring positive pair correlation according to preset
• using preset-specific external-range thresholds
• measuring divergence separation relative to ATR
• accumulating confirmation evidence across separate candles
• storing the SMT candle as the reaction trigger
• storing ATR at the moment the setup is armed
• using different confirmation strictness for Standard, Sniper, and Elite
• limiting historical objects without relocating signals
• providing automatic comparison-market assistance with manual override
• supporting both static and combined dynamic alerts
• exposing detailed diagnostics through the Data Window
The script is not a simple combination of unrelated indicators.
Every module supports the same objective: determining whether a closed-bar SMT divergence has enough liquidity, correlation, location, reaction, and confirmation evidence to become a permanent final signal.
━━━━━━━━━━━━━━━━━━━━━━
⚠️ IMPORTANT PRACTICAL NOTES
━━━━━━━━━━━━━━━━━━━━━━
Signal frequency depends on:
• Engine Preset
• chart symbol
• comparison symbol
• ticker naming
• timeframe
• session
• volatility
• pair correlation
• liquidity-reference structure
• sweep depth
• chart-candle quality
• external-range location
• divergence separation
• directional cooldown
• post-SMT displacement
• SMT-candle break
• FVG evidence
• micro-structure evidence
• final signal cooldown
• available history
• data provider
Standard can produce more setups.
Elite can produce substantially fewer setups.
Fewer signals do not guarantee better results.
The built-in Auto matrix uses predefined OANDA and BINANCE symbols.
The chart symbol can come from another broker or exchange.
Different feeds can produce:
• different highs and lows
• different candle closes
• different ATR values
• different liquidity sweeps
• different correlation readings
• different final signals
Manual mode can be used when comparison-feed consistency is important.
The current engine expects a positive relationship.
An inversely related comparison market should not be selected.
The dashboard’s UP and DOWN values are signal counts.
They are not wins and losses.
The Signal Score is a confluence score.
It is not historical accuracy.
The SMT marker is not the final signal.
The final UP or DOWN label appears after post-SMT confirmation.
Changing settings recalculates historical conditions.
Changing the comparison market can materially change the script’s output.
━━━━━━━━━━━━━━━━━━━━━━
⚠️ LIMITATIONS AND SHORTCOMINGS
━━━━━━━━━━━━━━━━━━━━━━
This script has important limitations:
It does not guarantee profitable trades.
It does not predict future price movement.
It does not execute orders.
It does not place broker stops.
It does not place take-profit orders.
It does not calculate position size.
It does not include spread.
It does not include commission.
It does not include slippage.
It does not include latency.
It does not model partial fills.
It does not model financing or swap.
It does not evaluate order-book conditions.
It does not evaluate news risk.
It uses bar-based OHLC data.
It does not reconstruct exact intrabar price sequence.
It assumes a positive comparison relationship.
Its automatic matrix cannot recognize every broker symbol.
Unsupported Auto symbols can use the Manual Comparison fallback.
Correlation can change over time.
A historically correlated pair can temporarily decouple.
A confirmed SMT divergence can fail.
A displacement candle can be followed by reversal.
An FVG can be filled immediately.
A micro-structure break can become a false break.
A high Base Quality Score can still fail.
A high Sniper Score can still fail.
The Signal Score is not a win probability.
The dashboard is not TradingView Strategy Tester.
Signal counts are not audited account performance.
The script does not provide verified profitability statistics.
The script does not provide broker-verified trade outcomes.
Alert delivery depends on TradingView and user configuration.
Changing settings changes historical calculations.
Changing symbol, exchange, session, timeframe, or feed can change signals.
Available history can affect rolling calculations.
Permanent final signals wait for candle close.
The final label can therefore appear later than a discretionary intrabar entry.
For these reasons, the indicator should be used as an educational decision-support tool, not as a standalone automated strategy.
━━━━━━━━━━━━━━━━━━━━━━
👤 WHO THIS SCRIPT MAY BE USEFUL FOR
━━━━━━━━━━━━━━━━━━━━━━
This script may be useful for traders who:
• understand basic SMT divergence
• compare positively related markets
• study liquidity sweeps and reclaims
• want more context than a raw SMT marker
• prefer confirmed-close signals
• want selective preset modes
• use displacement as confirmation
• use Fair Value Gap concepts
• use micro-structure breaks
• want automatic comparison-market assistance
• want a manual comparison override
• want transparent quality scoring
• want a compact public settings menu
• want a premium dashboard
• want separate SMT and final-signal alerts
• want one combined UP / DOWN dynamic alert
• want Data Window diagnostics
It may be less suitable for users who:
• want guaranteed signals
• want every raw SMT divergence displayed
• want a fully automated trading bot
• want built-in TP and SL management
• want verified Strategy Tester performance
• want inverse-correlation SMT analysis
• expect one comparison pair to work on every feed
• require tick-level execution modeling
• want signals before candle close
• expect a score to equal probability
• want the indicator to replace personal judgment
• expect alerts to execute broker orders automatically
━━━━━━━━━━━━━━━━━━━━━━
🧭 BEST PRACTICE SUGGESTIONS
━━━━━━━━━━━━━━━━━━━━━━
For the default selective profile:
• use standard candlesticks
• begin with Sniper preset
• keep Auto mode only when the dashboard comparison is appropriate
• use Manual mode for broker-specific comparison control
• select positively related markets
• keep Show SMT enabled while learning
• distinguish the SMT marker from the final signal
• wait for the final UP or DOWN label
• review the correlation value
• review the active Signal Score
• review external market structure independently
• consider session liquidity and volatility
• use personal stop placement
• use personal target planning
• use personal position sizing
• test alerts before depending on them
• test the exact symbol and timeframe personally used
For additional frequency:
• use Standard preset
Standard reduces:
• Base Quality requirements
• correlation requirements
• range-location restrictions
• divergence-separation requirements
• Sniper Score threshold
• final confirmation evidence
For additional selectivity:
• use Elite preset
Elite increases:
• minimum sweep depth
• rejection-close requirement
• minimum range expansion
• Base Quality threshold
• correlation threshold
• external-range restriction
• divergence-separation threshold
• Sniper Score threshold
• final evidence requirement
Always:
• wait for the candle to close
• verify the active comparison symbol
• use the SMT marker as context
• use the final signal as confirmation
• review broader structure independently
• review personal risk before any trade
• treat alerts as monitoring tools
• remember that every confirmed setup can fail
━━━━━━━━━━━━━━━━━━━━━━
🔓 PUBLICATION NOTE
━━━━━━━━━━━━━━━━━━━━━━
SMT Sniper Entry Engine is published as an educational correlated-market divergence and confirmation tool.
The purpose of this description is to explain:
• how the comparison market is selected
• how Auto and Manual modes differ
• which markets are included in the automatic comparison matrix
• how closed-bar liquidity references are calculated
• how a one-market sweep is identified
• how reclaim validation works
• how sweep depth is normalized by ATR
• how chart-candle direction and rejection quality are evaluated
• how the Base Quality Score is constructed
• how pair correlation is calculated and filtered
• how external-range location is evaluated
• how divergence separation is measured
• how the Sniper Score is constructed
• how Standard, Sniper, and Elite differ
• how a qualified SMT event arms the confirmation engine
• how the temporary confirmation window works
• how evidence is accumulated across separate closed candles
• how displacement is detected
• how the SMT-candle break is used
• how Fair Value Gap evidence is detected
• how micro-structure evidence is detected
• how setup invalidation works
• how setup expiration works
• when final UP and DOWN labels appear
• what the SMT markers and dotted reference lines represent
• what the signal FVG box represents
• what the dashboard displays
• what the static alerts contain
• how “Any alert() function call” works
• what diagnostic values are available in the Data Window
• how confirmed-close timing works
• what the engine does not simulate
• why familiar SMT concepts are organized into an original workflow
The script is designed to support structured analysis.
It does not promise profitable results.
It does not remove market risk.
It does not execute trades.
It does not calculate position size.
It does not provide a built-in TP / SL trade-management model.
It should not be used as a blind UP / DOWN system.
Repainting and Timing Disclosure
SMT Sniper Entry Engine is designed around confirmed-bar calculations.
Permanent SMT events and final UP / DOWN labels use barstate.isconfirmed.
The comparison-market request uses:
• barmerge.gaps_off
• barmerge.lookahead_off
Liquidity references use previous closed candles.
The current candle is excluded from the prior-reference calculation.
The script does not use:
• pivot-high functions
• pivot-low functions
• future-bar confirmation
• negative plot offsets
• historical signal backplotting
• later relocation of final signal labels
A final UP or DOWN signal appears on the candle where the complete confirmation sequence becomes valid.
It is not moved backward to the original SMT candle.
Historical drawing cleanup can delete older lines, markers, labels, or boxes when the recent-object limit is exceeded.
Deleting an old drawing is not repainting.
The original signal bar is not changed.
Historical results can still differ when:
• settings are changed
• comparison symbols are changed
• Auto or Manual mode is changed
• chart symbols are changed
• timeframes are changed
• broker or exchange feeds are changed
• historical data is revised
• available chart history is changed
Realtime behavior also depends on when TradingView receives the final data for the closing candle.
Confirmed-close design reduces unfinished-candle changes.
It does not eliminate market risk, data-feed differences, or alert-delivery limitations.
━━━━━━━━━━━━━━━━━━━━━━
🛡️ DISCLAIMER
━━━━━━━━━━━━━━━━━━━━━━
SMT Sniper Entry Engine is provided for educational and informational purposes only.
It does not constitute financial, investment, trading, legal, or tax advice.
No indicator can guarantee future results.
Markets are uncertain.
Correlation changes.
Liquidity changes.
Volatility changes.
Market structure changes.
Historical chart behavior does not ensure future performance.
Every user is responsible for their own:
• analysis
• validation
• comparison-market selection
• execution planning
• stop placement
• target planning
• position sizing
• risk management
• alert configuration
• trading decisions
• broker execution
• legal obligations
• tax obligations
The liquidity references, SMT markers, dotted lines, Base Quality Scores, Sniper Scores, correlation values, external-range filters, divergence-separation values, displacement conditions, Fair Value Gap boxes, micro-structure conditions, UP labels, DOWN labels, dashboard states, Data Window values, signal counts, and alerts are visual analysis tools only.
The SMT marker is not a guaranteed reversal.
The UP label is not a guaranteed profitable long trade.
The DOWN label is not a guaranteed profitable short trade.
The Signal Score is not a win probability.
The Base Quality Score is not a probability.
The correlation reading is not a guarantee that two markets will continue moving together.
The automatic comparison symbol is not guaranteed to be suitable for every broker feed.
The FVG box is not a guaranteed support or resistance zone.
The micro-structure break is not a guarantee of continuation.
The final signal-bar close is not a guaranteed fill.
The script does not include spread, commission, slippage, latency, financing, contract specifications, order rejection, partial fills, or broker-specific execution behavior.
Use this script as a structured SMT divergence-review and confirmation framework, not as a promise of profitability or a substitute for independent judgment.
Indikator

SMT w AlertsThis script is a Smart Money Tool (SMT) Divergence Indicator written in TradingView's Pine Script v6. It automatically detects and visualizes instances where highly correlated assets (like NQ, ES, and YM) fall out of sync at major price swings.
Here is a breakdown of how the script works and its key features:
1. Core Logic (Pivot Tracking)
The script uses ta.pivothigh and ta.pivotlow to identify swing highs and swing lows on your main chart based on a window of bars (default 3 bars left and right). It remembers the most recent pivot and the one right before it so it can compare the two.
2. Dual-Symbol Comparison
When a pivot is confirmed on your main chart, the script immediately looks at the price action of two comparison symbols (e.g., MNQ and MES) at that exact same time.
Tolerance Window: Because assets like NQ and ES don't always peak on the exact same 1-minute or 5-minute candle, the script includes a "Comparison Tolerance" input. It looks a few bars before and after the pivot on the comparison symbols to find their true peak/valley.
3. Divergence Detection
The script compares the slope of the pivots on your chart against the comparison symbols:
Bearish SMT (Highs): If your chart makes a Higher High, but the comparison symbol makes a Lower High (or vice versa). This indicates underlying weakness in the buying pressure.
Bullish SMT (Lows): If your chart makes a Lower Low, but the comparison symbol makes a Higher Low (or vice versa). This indicates underlying strength in the selling absorption.
It checks both comparison symbols simultaneously — if an SMT forms against either of them, it triggers the signal.
4. Visuals & Aesthetics
The SMT Bracket: When an SMT is detected, it draws a clean bracket (or "bridge") connecting the two diverging pivots. It draws horizontal tick marks at the pivots, vertical lines extending outward, and a horizontal bridge connecting them with a small "SMT" label. The bracket dynamically sizes itself using ATR (Average True Range).
Unused Pivots: Pivots that do not result in an SMT divergence are optionally connected with subtle grey dashed lines so you can see the market structure.
Bar Coloring: The candle where the SMT is officially confirmed is highlighted with a subtle background color.
5. Dashboard & Alerts
Dashboard: A clean table in the top right corner tracks how many Bearish and Bullish SMTs have occurred on the chart, and how many bars ago the most recent one fired.
Alerts: The script exposes alert conditions (alertcondition) that you can hook into TradingView's alert system to receive notifications when a Bullish or Bearish SMT forms. Indikator

SMT - NDOG - NWOG - CBDR - FLOUT - Z DAYHere is a simple breakdown of how it works and how to use it:
1. Z-Day Profile (The "Coiled Spring")
What it is: A Z-Day is an ICT concept representing a day of extreme consolidation where the market essentially goes nowhere (zero net change). How the script tracks it: The script calculates the Average Daily Range (ADR) over the last 14 days. If a trading day finishes and its total range was less than 50% of the normal ADR, the script stamps a yellow "Z-DAY" label at the start of the next day. How to use it: When you see a Z-Day label, expect massive, violent expansion (trend days) to occur shortly after, as institutional energy has been tightly coiled.
2. SMT Divergence (Smart Money Tool)
What it is: SMT spots fake moves or underlying strength/weakness by comparing two assets that should move together (like NQ and ES). How the script tracks it: You enter a correlated ticker in the settings (e.g., CME_MINI:ES1!). The script pulls that asset's data in the background. It then tracks swing highs and lows on both charts simultaneously. How to use it: If your current chart makes a Lower Low (sweeping liquidity), but the hidden SMT chart makes a Higher Low, the script flags this as a Bullish SMT. It means the down-move on your chart is likely a fake stop-hunt, and price is preparing to reverse upward.
3. Price Action Gaps (NDOG & NWOG)
What it is: Voids in price caused by the market closing and reopening. These gaps act as algorithmic magnets. How the script tracks it:
NDOG (New Day Opening Gap): Tracks the gap between the 5:00 PM EST close and the 6:00 PM EST reopen.
NWOG (New Week Opening Gap): Tracks the gap between Friday's close and Sunday's reopen. How to use it: The script draws colored boxes over these gaps and extends them endlessly to the right. The box will only disappear once price completely overlaps and "fills" the gap, allowing you to use them as high-probability draw-on-liquidity targets.
4. Dealer Ranges & Projections (CBDR & Asian)
What it is: Institutions accumulate orders during specific quiet hours (Dealer Ranges), and then manipulate or expand price outward based on those ranges. How the script tracks it:
It boxes the absolute High and Low printed during the CBDR (Central Bank Dealers Range, 14:00-20:00 NY time).
It boxes the absolute High and Low printed during the Asian Range (20:00-00:00 NY time).
How to use it: The exact moment the Asian Range finishes at midnight, the script measures the height of the CBDR box. It then projects Fibonacci Standard Deviation lines (+1, +2, -1, -2) out into the future. You use these dashed lines as algorithmic take-profit targets for the new trading day.
It also calculates the Flout, which combines the CBDR and Asian ranges together, cuts them in half, and projects dotted lines for alternate target projections. Indikator

Asset Class Correlation MatrixAsset Class Correlation Matrix
█ OVERVIEW
This indicator displays a Pearson correlation matrix for instruments in the asset class of the symbol you are currently viewing. Open a EUR pair and you see the forex matrix. Open gold and you see the metals matrix. Open Bitcoin and you see the crypto matrix. The relevant basket loads automatically, so there is nothing to configure for the common cases.
Each cell shows the rolling correlation between two instruments over a lookback period you control. The goal is to make cross-instrument relationships inside an asset class visible at a glance, rather than checking pairs one at a time, or relying on visual comparison.
█ AUTOMATIC ASSET CLASS DETECTION
The current symbol is matched to a category in three stages:
1. Exact ticker match against the built-in lists below.
2. Name-fragment match for common broker and CFD names. For example XAU and GOLD map to Metals, US500, SP500, NAS100, US100, US30 and DJ30 map to US Indices, DAX, FTSE and NIKKEI map to Global Indices, and WTI, BRENT and NATGAS map to Energy.
3. Asset type fallback using the instrument type, covering crypto, forex, and stocks.
If the current symbol is not already part of a built-in list, it is added as the first row and column of the matrix, so the instrument you are on is always included. If no category can be determined, the table shows a short prompt to use the custom symbol list instead of rendering empty.
█ BUILT-IN CATEGORIES
Forex: 28 majors and crosses across USD, EUR, GBP, JPY, AUD, CAD, CHF and NZD.
US Indices: ES, NQ, YM, EMD, RTY.
Global Indices: DAX, Euro Stoxx 50, Nikkei, FTSE, ASX 200, Hang Seng.
Metals: Gold, Silver, Copper, Platinum, Palladium.
Energy: WTI Crude, Natural Gas, Heating Oil, RBOB Gasoline.
Agricultural: Corn, Soybeans, Wheat, Soybean Oil, Soybean Meal, Cocoa, Coffee, Sugar, Cotton, Orange Juice.
Livestock: Live Cattle, Lean Hogs, Feeder Cattle.
Interest Rates: 2Y, 10Y, 30Y US notes, Euro Bund, Euro Buxl.
Crypto: BTC, ETH, BCH, LTC.
Stocks: SPX, QQQ, AAPL, MSFT, NVDA, AMZN, GOOGL, META, TSLA, AMD.
█ READING THE MATRIX
Pearson correlation ranges from -1 to +1.
Values near +1 mean the two instruments move strongly together. Values near -1 mean they move strongly opposite to each other, which is still a strong relationship, just inverted. Values near 0 mean little to no linear relationship.
The strength of a relationship is the distance from zero, in either direction. A reading of -0.9 is just as tight as +0.9.
█ COLORS
Positive correlation is shown in green, with a stronger shade above the high threshold and a lighter shade above the moderate threshold. Inverse correlation is shown in purple, using the same two strength levels. Everything between the negative and positive moderate threshold is shown as low. All five colors and both thresholds are adjustable in the settings. The thresholds apply symmetrically to positive and inverse values.
█ CUSTOM SYMBOL LIST
You can override the auto-detected basket with your own comma-separated list of symbols. Spaces are ignored. The custom list is applied only when the current chart symbol is one of the symbols in the list, which keeps the chart instrument anchored in the matrix.
You can include an exchange or broker prefix, for example OANDA:EURUSD. A bare ticker such as GBPJPY inherits the current chart prefix. Bare futures contracts such as ES1! resolve on their native exchange.
█ SETTINGS
Period: lookback in bars for the correlation calculation. Shorter reacts faster and is noisier. Longer is more stable and slower to update.
High and Moderate Correlation Thresholds: the cutoffs for the color bands.
Colors: the five correlation colors.
Symbol List: the optional custom basket.
Table Size: text size of the matrix.
█ HOW TO USE IT
Add the indicator to any chart in a supported asset class. Use it to find pairs that move together or opposite each other, to check diversification across a basket, to spot when a normally correlated pair is diverging, or to choose hedges and pairs-trade candidates. The left column shows the full applied symbol for each row, so you can confirm exactly which feed each value comes from.
█ NOTES AND LIMITATIONS
Correlation is period-dependent. For tightly linked instruments, a long lookback pushes most values toward the extremes, while a short lookback spreads them out and reacts faster. Choose the period to match the question you are asking.
Correlation measures linear co-movement of closing prices on the chart timeframe. It does not imply causation and does not capture non-linear relationships.
Broker naming for CFDs varies widely, so some instruments may not auto-detect. When that happens, use the custom symbol list.
A maximum of 28 instruments can be loaded in one matrix. Indikator

CandelaCharts - Breadth Divergence📝 Overview
The CandelaCharts - Breadth Divergence indicator identifies structural divergences between the primary chart's price action and a secondary breadth or macroeconomic symbol (such as VALUG (Value Line Geometric Index), USI:ADD (Advance-Decline Issues), or US10Y (Treasury Yields)).
Because you can plug any custom ticker into the indicator, it functions perfectly as an inter-market or macro divergence tool. By analyzing pivot highs and lows, it detects when the underlying market breadth or macro environment fails to confirm the price movement, signaling potential market reversals.
Bearish Divergence: Occurs when the main chart makes a Higher High while the breadth/macro symbol makes a Lower High.
Bullish Divergence: Occurs when the main chart makes a Lower Low while the breadth/macro symbol makes a Higher Low.
📦 Features
Automated Divergence Detection: Accurately maps regular bullish and bearish divergences using customizable pivot points.
Customizable Breadth Symbol: Set any symbol to act as the breadth index to measure internal market strength.
Visual Clarity: Highlights divergence zones with clean lines connecting the pivots and shaded background boxes for easy identification.
Flexible Lookbacks: Complete control over pivot lookback lengths to adapt the sensitivity to any timeframe or volatility condition.
📈 Supported Assets & Timeframes
This indicator is universally compatible with any asset class (Equities, Crypto, Forex, Commodities, Indices) and any timeframe . To adapt the indicator to a different market, you only need to change a single input: the Breadth Symbol . For example:
S&P 500 ( SPY , ES1! ): Set the Breadth Symbol to USI:ADD (Advance-Decline), USI:VOLD (Up/Down Volume), RSP (Equal Weight), or VALUG (Value Line).
Nasdaq 100 ( QQQ , NQ1! ): Set the Breadth Symbol to USI:ADDQ (Nasdaq Advance-Decline), USI:VOLDQ , QQQE (Equal Weight), or VXN (Nasdaq Volatility).
Forex / Currencies (e.g. EURUSD , GBPUSD ): Set the Breadth Symbol to DXY (US Dollar Index) or US10Y (US 10-Year Treasury Yield).
Crypto ( BTCUSD ): Set the Breadth Symbol to TOTAL3 (Altcoin Market Cap) or BTC.D (Bitcoin Dominance).
⚙️ Settings
Breadth Symbol: The ticker used to compare against the main chart (Default: VALUG - Value Line Geometric Index).
Pivot Left / Right: The number of bars required to the left and right to confirm a pivot high or low.
Bullish / Bearish Colors: Customize the color of the divergence lines and background boxes. The backgrounds automatically apply a 90% opacity to the chosen colors.
⚡️ Showcase
S&P 500 ( ES1! ) vs. VALUG : Show a bullish divergence where ES makes a lower low but the Value Line Geometric Index makes a higher low.
Nasdaq 100 ( NQ1! ) vs. ADDQ : Highlight a scenario where the cap-weighted NQ pushes higher but the Nasdaq Advance-Decline diverges, signaling weakness in the broader tech sector.
Ethereum ( ETHUSD ) vs. TOTAL3 : Show a bearish divergence where Ethereum makes a higher high, but the broader Altcoin market cap fails to follow suit.
Euro ( EURUSD ) vs. DXY : Display an inverse divergence setup using the US Dollar Index.
🚨 Alerts
This indicator features built-in alerts using the `alert()` function. You can create an alert on the indicator to be notified whenever a Bullish or Bearish Breadth Divergence is detected.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Indikator

Indikator

SMT-Fill [Oracle]WHAT THIS INDICATOR DOES
SMT-Fill is a correlation-based fair value gap analysis tool that detects when correlated assets disagree on how they interact with their own imbalances. It identifies FVGs that form simultaneously across multiple correlated assets, then tracks whether each asset trades back into its respective gap — and flags when one asset fills its gap while the other does not.
A standard FVG tells you there is an imbalance. An SMT-Fill tells you there is an imbalance where correlated assets are disagreeing on whether it gets respected — a crack in correlation at the imbalance level, which increases the probability of a reaction.
This is an analysis and narrative tool. It does not generate buy or sell signals.
THE CONCEPTS — WHAT EACH ONE IS AND HOW IT IS CALCULATED
Fair Value Gaps (FVGs)
A fair value gap is a 3-bar price imbalance where the candle bodies moved so aggressively that a gap was left behind. The indicator detects these using standard FVG logic:
Bullish FVG — Bar 1's low is above bar 3's high. The gap between these two levels represents an area where price moved up without being fully traded, leaving an imbalance that price may return to fill.
Bearish FVG — Bar 3's low is above bar 1's high. The gap represents a downward imbalance.
The indicator does not just detect FVGs on your chart — it simultaneously checks whether the same FVG pattern exists on each of the other assets in your triad at the exact same time, using request.security calls. For each asset where a concurrent FVG exists, it stores that asset's own gap boundaries (high, low, and midpoint) independently.
This means the indicator is tracking up to four versions of the same gap: your chart asset's FVG boundaries and each correlated asset's FVG boundaries, all formed on the same 3-bar window but at each asset's own price levels.
SMT-Fill Divergence Detection
This is the core concept. After an FVG forms across multiple assets, the indicator tracks whether price on each asset trades back into its respective gap. An SMT-Fill divergence occurs when one asset trades into its gap while a correlated asset does not trade into its corresponding gap — the assets disagree on whether the imbalance gets filled.
The indicator monitors three levels within each gap:
High — The top boundary of the FVG. Has price touched back into the gap at all?
Midpoint (50%) — The equilibrium of the FVG. Has price traded through the halfway point?
Low — The bottom boundary of the FVG. Has price completely filled the gap?
For each level, the indicator maintains a "traded" flag for every asset. On every bar, it checks whether each asset's price has reached that level in its own FVG. A divergence is detected when your chart asset's traded flag differs from a correlated asset's traded flag at any level — meaning one has interacted with the gap at that level while the other has not.
This produces three variants of SMT-Fill, each representing a different degree of divergence:
Variant 1 — Touch divergence. One asset trades back into the gap (touching the high of the FVG), while the correlated asset fails to trade back into its gap at all.
Variant 2 — Midpoint divergence. One asset trades below 50% of its gap, while the correlated asset fails to reach the 50% level of its gap.
Variant 3 — Full fill divergence. One asset completely fills its gap (price reaches the low/high boundary), while the correlated asset fails to completely fill its corresponding gap.
The indicator prioritises the most significant divergence level when drawing the SMT-Fill line. For bullish gaps, it checks the high level first (has any asset touched the gap while another hasn't), then midpoint, then low. For bearish gaps, it checks low first, then midpoint, then high.
Gap Lifecycle and Cleanup
Each tracked gap has a defined lifecycle:
Creation — A 3-bar FVG is detected on your chart, and the same FVG pattern exists on at least one other asset in the triad at the same time.
Active tracking — The indicator monitors whether each asset's price interacts with its own version of the gap at the high, midpoint, and low levels.
Divergence display — When the traded flags disagree between assets at any level, the gap is drawn as a colored box with an optional SMT divergence line at the diverging level.
Closure — When price closes completely through the gap (close below the low for bullish, close above the high for bearish), the gap is automatically deleted from the chart.
Gaps where no divergence exists between assets are hidden by default — the indicator only shows FVGs where a crack in correlation has occurred within the imbalance.
SMT-Fill Divergence Line
When a divergence is detected, an optional horizontal line is drawn at the specific level where the disagreement occurs (high, midpoint, or low of the gap). This line marks the exact price level where one asset has interacted with the gap but the other has not — the precise point of the crack in correlation within the imbalance.
The line extends as long as any asset is still interacting with the gap, plus a configurable extension buffer.
HOW THE CONCEPTS WORK TOGETHER
SMT-Fill is not simply an FVG detector with extra assets overlaid. The concepts form a specific analytical sequence:
Concurrent FVG formation establishes the setup. A fair value gap must form on your chart asset and on at least one correlated asset at the exact same time. This is the prerequisite — it means both assets experienced the same imbalance event simultaneously, establishing a shared reference point.
Independent fill tracking reveals disagreement. After the gap forms, each asset's price moves independently. The indicator tracks whether each asset returns to its own gap boundaries. When one fills while the other holds, it reveals that the market is not treating the imbalance the same way across correlated assets — a crack in correlation specifically within the imbalance itself.
The divergence level identifies the price point. The SMT-Fill line marks exactly where the disagreement is occurring — whether at the gap entry (high), equilibrium (midpoint), or full fill (low). This gives you a specific price level to work with, not just a directional bias.
Gap lifecycle provides context. Gaps that are fully closed are automatically removed. Only gaps with active divergences are displayed. This keeps the chart clean and focused on the information that matters — where correlated assets are currently disagreeing on imbalance interaction.
HOW TO USE IT
For HTF Bias:
SMT-Fills on higher timeframes can frame lower timeframe trade ideas. For example, if you expect a bullish weekly candle and see price manipulate down into a daily FVG forming an SMT-Fill, you can assume that manipulation is likely the manipulation for the week — giving you a directional bias and allowing you to frame LTF entries accordingly.
As an Entry Model:
SMT-Fill can be combined with other Quarterly Theory concepts to build confluence. For example:
SSMT forms, then the first presented gap is an SMT-Fill — higher probability entry
A PSP forms, then the first presented gap is an SMT-Fill — confirmed reversal with imbalance divergence
Any ICT entry model that involves an FVG can use SMT-Fill to increase the setup probability by confirming the gap is backed by a correlation crack
Step by step:
Add the indicator to your chart. It will automatically detect your asset triad and begin scanning for concurrent FVGs.
When an FVG forms on your chart and on at least one correlated asset simultaneously, the indicator begins tracking fill levels on all assets.
Once one asset trades into its gap while another does not, a colored box appears showing the SMT-Fill gap with a label indicating which asset is diverging.
The SMT-Fill divergence line marks the exact level where the disagreement is occurring.
Gaps are automatically removed when fully closed, keeping your chart clean.
WHY THIS IS THIS INDICATOR WORTH USING?
Without this indicator, identifying an SMT-Fill requires a trader to:
Watch three charts simultaneously and mentally note when FVGs form at the same time across all of them
Track the exact high, midpoint, and low of each gap on each asset independently
Monitor in real time whether each asset trades back into its own gap at each of these three levels
Compare the fill status across assets to determine if a divergence exists
Remember which gaps have been fully closed and which are still active
This is practically impossible to do manually in real time across three assets and multiple active gaps. The indicator automates the entire process — concurrent FVG detection, independent multi-level fill tracking across all triad members, divergence flagging, and automatic lifecycle management — into a single overlay.
The SMT-Fill concept itself — tracking whether correlated assets agree or disagree on how they interact with simultaneously-formed imbalances — is an entirely original implementation. No other TradingView indicator detects concurrent FVGs across multiple assets, independently tracks fill levels at three price points per asset, and flags the divergence when assets disagree. This cannot be replicated by combining existing public FVG indicators because they only track a single asset and have no concept of cross-asset fill comparison.
AUTO TRIAD
The indicator automatically assigns the correct correlated triad based on your chart ticker:
Index Futures: NQ / ES / YM (+ micro variants MNQ / MES / MYM)
FX Indices: NAS100 / SPX500 / US30
Metals (spot): XAUUSD / XAGUSD / Copper
Metals (futures): GC / SI / HG
Forex: EURUSD / GBPUSD / DXY
Currency Futures: 6E / 6B / DXY
Energy: CL / RB / HO
Bonds: ZF / ZB / TN
Crypto (spot): BTCUSD / ETHUSD / XRPUSD via Kraken
For unsupported tickers, manual configuration is available.
SETTINGS OVERVIEW
Asset Selection — Auto triad toggle, manual ticker inputs for three assets
General Settings — Maximum gaps tracked, box extension length
Gap Display — Bullish/bearish toggles, gap colors, border display and width
SMT-F Line — Divergence line toggle, color, style, width
Labels and Text — Asset label toggle, text size, text color, label position
Filtering — Active-only mode (only show gaps while price is interacting)
Watermark — Position, size, custom phrase
INDICATOR SETTINGS/FILTERS
Here is an inside look of how the SMT-Fill looks:
DISCLAIMER
This indicator is for educational and informational purposes only. It does not constitute financial advice. Trading involves substantial risk of loss. Always use proper risk management and conduct your own analysis.
CREDITS
Developed by Danielliuks (z3nius) and bucko. Conceptual framework based on ICT (Michael Huddleston) and Quarterly Theory as taught by TraderDaye.
Open Sourced For all.
Enjoy. Indikator

Ultimate FVG/NWOG By FreedomByChartsUltimate FVG/NWOG By FreedomByCharts
A clean, no-bloat FVG and NWOG indicator built around how I actually trade: chart timeframe + three independent higher timeframes + the New Week Opening Gap, all in one global colour scheme with sensible defaults and granular per-source control.
Why this one
Most FVG indicators on TV fall into one of two camps. Either they're stripped down to the bare chart-timeframe pattern with a single fill colour and a hardcoded mitigation rule, or they're bloated with theme presets, IPDA modes, half-finished features and ten settings groups you'll never use. This one is built the other way round: deep where it matters (mitigation logic, NWOG accuracy, display control), and stripped of everything that doesn't earn its place on the chart.
What's actually different:
Four mitigation modes, not one. Wick Filled (full), Body Filled (full), Wick 50%, Body 50%. Pick what matches your model — strict body close beyond the far side, or a partial wick into the midpoint, or anything between.
Independent box and line visibility per source. Box on, lines off. Lines on, box off. Top + bottom only, no middle. Mid line dotted, top and bottom solid. Whatever you want — five sources, each independent.
Mitigated FVGs become iFVGs. When an FVG gets mitigated its label flips from e.g. `1H` to `1H iFVG`, marking the zone as an inverted FVG — the same level can now act in the opposite direction. NWOG labels stay as `NWOG` since the inversion concept doesn't apply.
Mitigated zones can drop their lines automatically. Per-source toggle: keep the grey box for context, lose the line clutter. Active zones stay fully drawn.
Three HTFs at once, plus chart TF, plus NWOG. Run 1H, 4H, 1D simultaneously while the chart-TF FVGs print on whatever you're looking at. Each fully configurable. No request.security guesswork — the HTF tracking is explicit and aligned to the chart bars where each HTF period's high and low actually occurred.
NWOG done properly, including holiday weeks. The NWOG anchors to the close of the last 1H bar before the weekend (Friday on a normal week, Thursday on Easter / Good Friday week) and the open of Sunday's first 1H bar. No stale Friday-only state, no wrong-priced boxes anchored at the wrong bar after holiday closes.
Single global colour scheme. One bullish colour, one bearish colour, one mitigated grey. Applied uniformly across every source for a clean, professional look. NWOG can override its own bull/bear colours if you want it to stand out.
No display caps you have to work around. Set the unfilled count and mitigated count per source to whatever you actually want to see. Old zones get pruned automatically as new ones form.
What it draws
Chart FVGs — current timeframe, both bullish and bearish.
HTF1, HTF2, HTF3 — three configurable higher timeframes (defaults: 1H, 4H, 1D), all rendered on the current chart.
NWOG — the body gap between the close of the last 1H trading bar before the weekend and the open of Sunday's first 1H bar.
For each zone you get an optional coloured box (transparency adjustable), an optional top line, mid line, bot line (each with independent show/hide and Solid/Dashed/Dotted style), and an optional label showing the timeframe (auto-formatted as "1H", "4H", "1D", "NWOG", etc).
When a zone is mitigated, the box recolours to grey, the lines either go grey or hide entirely depending on the per-source toggle, and the label flips to show iFVG status (e.g. `1H` becomes `1H iFVG` — NWOGs keep their `NWOG` label). Mitigated zones stay visible for as many slots as you allow, then get pruned.
Mitigation methods explained
For a bullish FVG (zone below price), the chosen method tests whether price has come back down into the zone:
Wick Filled (full) — bar's low has reached the bottom of the zone. Default.
Body Filled (full) — bar's close has reached the bottom of the zone.
Wick 50% — bar's low has reached the midpoint.
Body 50% — bar's close has reached the midpoint.
Bearish zones (above price) test the opposite direction. Mitigation triggers an alert if you've enabled it for that source.
Alerts
Two alert flags per source: entry (price first touches the zone) and mitigation (price meets the mitigation criterion). Alert text identifies the source timeframe, direction (bull or bear) and the price.
Settings, top to bottom
Appearance — bull / bear / mitigated colours, box transparency, mitigated box transparency, line width, right-edge extension (default 0 = right edge sits at the current bar; raise it to extend further right), label text colour.
Mitigation — single global mitigation method dropdown.
Chart — enable, box / line visibility, line styles, unfilled and mitigated counts, mitigated-lines toggle, label settings, alerts.
HTF 1, HTF 2, HTF 3 — same controls as Chart plus a timeframe input.
NWOG — same controls as the others, plus optional NWOG-specific bull/bear colour overrides.
Notes on usage
For NWOG live detection use a 1H or smaller intraday chart. On 4H+ charts the bar boundaries don't land on the 18:00 NY moment cleanly so new NWOGs won't form.
HTF FVGs appear on the chart at the bar where their HTF period closed, anchored back to the chart bars where the relevant HTF candle highs and lows occurred — this gives a clean "stepped" visual at the zone's left edge that shows how it formed.
The right edge of every zone tracks the current bar in real time. Set "Extend right beyond current bar" higher if you prefer a fixed runway.
TradingView caps total drawn objects at 500 lines / 500 boxes / 500 labels. With three lines per zone enabled across many sources at high display caps, you can hit those limits — drop the mid line first (it's off by default for that reason) and you double your headroom.
Built specifically for the way I trade GC futures on the 1H. Sharing because I haven't seen another FVG indicator that handles all three of these together: holiday-week NWOGs, four mitigation modes, and independent box/line control per source. Feedback welcome. Indikator

Minicharts Multi Market [Herman]Minicharts Multi Market
Minicharts Multi Market is a multi-asset visualization tool designed to display several different markets directly on a single chart using compact embedded mini charts.
Instead of switching between multiple tabs and layouts, this script allows traders to monitor intermarket behavior, relative strength, SMT relationships, and higher timeframe structure from one workspace.
The indicator is intended as a visual decision-support tool only and does not generate buy or sell signals.
Purpose
The main goal of this script is to improve chart workflow and market awareness by allowing users to:
• Monitor multiple correlated assets at the same time
• Compare futures markets such as NQ, ES, YM, RTY, CL, GC and others
• Observe relative strength and weakness across markets
• Identify potential SMT divergences between correlated instruments
• Keep higher timeframe structure visible while executing on lower timeframes
• Reduce the need to constantly switch charts during active trading sessions
This helps traders maintain better context and avoid missing important intermarket information.
How It Works
The script uses request.security() to retrieve OHLC data from multiple user-selected symbols and reconstructs them as compact mini charts displayed on the right side of the main chart.
Each mini chart functions independently and can display:
• Custom symbol
• Custom timeframe
• Optional EMA
• Optional VWAP
• Optional SMT detection
• Optional HTF Fair Value Gaps (FVG / iFVG)
The indicator does not use repainting logic for visualization purposes and is designed for structural reference and contextual analysis.
Main Features
1. Multi-Asset Minicharts
Display up to 6 different assets simultaneously.
Examples:
• NQ
• ES
• YM
• RTY
• CL
• GC
• SI
• Forex pairs
• Indices
• Any TradingView-supported symbol
Each chart can use its own symbol and its own timeframe.
This makes the script useful for:
• Index traders
• Futures traders
• SMT traders
• Intermarket analysis
• Session-based traders
• Higher timeframe structure alignment
2. Automatic SMT Detection
The script includes optional SMT (Smart Money Technique) divergence visualization.
It automatically detects correlated comparison assets:
Examples:
• NQ ↔ ES
• ES ↔ NQ
• YM ↔ ES
• RTY ↔ ES
• GC ↔ SI
• CL ↔ RB
When pivot highs or lows diverge between assets, the script highlights these areas visually.
This feature is designed to assist traders who use SMT as confirmation, not as a standalone entry signal.
3. EMA Overlay
Each mini chart can optionally display EMA.
Settings include:
• Enable / disable EMA globally
• Enable / disable EMA per mini chart
• Custom EMA period
• Custom EMA color
This helps users quickly identify trend alignment across markets.
4. VWAP Overlay
Each mini chart can optionally display VWAP.
Settings include:
• Enable / disable VWAP globally
• Enable / disable VWAP per mini chart
• Custom VWAP color
This allows users to monitor mean reversion and institutional reference pricing across multiple instruments.
5. HTF Fair Value Gaps (FVG)
Optional HTF Fair Value Gap visualization is included.
The script detects:
• Bullish FVG
• Bearish FVG
• Inverted FVG (iFVG)
Users can choose:
• Extended mode
• Next Bar Only mode
This helps provide additional structural context on higher timeframe inefficiencies.
Settings Overview
Minicharts Assets Setup
For each mini chart:
• Enable / disable chart
• Select symbol
• Select timeframe
• Enable / disable SMT
• Enable / disable EMA
• Enable / disable VWAP
Each of the 6 mini charts can be customized independently.
EMA Configuration
• Show EMA
• EMA period
• EMA color
VWAP Configuration
• Show VWAP
• VWAP color
HTF FVG Configuration
• Show FVG
• Extension mode
• Bullish FVG color
• Bearish FVG color
• Inverted FVG color
Style & Layout
• Pivot lookback for SMT
• SMT colors
• Candle colors
• Number of bars shown
• Bar spacing
• Background frames
• Right offset
• Column spacing
• Chart height
• Row spacing
• Asset / timeframe labels
These controls allow users to fully adapt the layout to their chart style.
Important Notes
This script is designed for visualization purposes only
It does not generate trading signals, alerts, or recommendations
All calculations are based on historical price data
The tool is intended to support chart analysis, not replace independent decision-making Indikator

cracks in correlation (smt)introducing what (in my opinion) might be the best open-source smt divergence indicator yet!
as you may know, an SMT divergence forms when 2 correlated pairs' structure diverges (i.e. NQ makes a higher high and ES makes a lower high). when this happens, smart money traders take advantage of the "crack in correlation" and enter positions looking for the assets to converge again. with this indicator, you will NEVER miss an smt again!
allow me to bore you with the technicals for a bit. while most smt indicators only compare 2 pivots, this one (using the amazing ZigZag library by Trendoscope), allows us to compare up to 128 different pivots at once, ensuring that every high is compared with every other high. this setting is controlled using the "memory buffer" counter inside the inputs of the indicator. raising this setting will make the indicator take more time to load, but will also show you more potential smts. using this zigzag, we're able to check whether the corresponding asset's structure is the same as the current one.
all of the other settings should be self-explanatory, but should you have any questions, you can reach out to me in the comments below.
as this indicator is open-source, feel free to reuse it as you wish, but if you are re-using significant portions of it, please credit me. it would mean a lot to me :>
thank you for using my indicator. happy trading! Indikator

SMT Divergence | Multi-Index Liquidity ComparisonSMT Divergence Map | Multi-Index Liquidity Comparison
Description:
Overview
This indicator tracks structural divergence between correlated index futures by comparing relative highs and lows across multiple markets. It is designed as a market-structure mapping tool, not as a standalone trade signal. The goal is to make intermarket disagreement visible so the user can judge whether one market is confirming or failing to confirm the movement of another.
What the script plots
The script compares selected symbols such as NQ, ES, and YM and highlights divergence when one market takes a corresponding high or low while another does not. It can monitor multiple timeframes and can also project selected higher-timeframe reference levels onto the active chart so the user can evaluate divergence in context.
How the logic works
The script reads highs and lows from 7 lookback bars of the selected symbols over the chosen comparison windows to the current market price. A bearish-style divergence is identified when one market trades above a prior reference high while another correlated market fails to do the same. A bullish-style divergence is identified when one market trades below a prior reference low while another correlated market fails to confirm that low. The script then plots the relevant divergence markers and optional reference lines on the chart.
Inputs and customization
Users can choose which symbols to compare, which timeframes to evaluate, which divergence types to display, and whether to show supporting structures such as prior highs/lows, session references, daily references, or higher-timeframe range levels. Visual controls allow the user to adjust labels, line styles, colors, table size & transparency customization and display density.
How to use it
This tool is best used as a structural context layer. It helps identify areas where correlated markets stop agreeing, which may matter near liquidity sweeps, session extremes, or higher-timeframe reference levels. The script does not place orders and does not guarantee reversal or continuation. It simply visualizes divergence so the trader can combine it with their own execution framework.
Originality / why this script exists
This publication consolidates multiple SMT comparison functions into one configurable tool so users do not need several overlapping variants. The purpose is not to merge indicators for the sake of a mashup, but to provide one organized framework for viewing intermarket divergence, session references, and higher-timeframe structure in a single workflow.
Limitations
Divergence is contextual and does not automatically imply a successful trade. Different data feeds, symbol mappings, session settings, and timeframes can change what is displayed. Users should verify the symbol configuration and session definitions before relying on the output.
Note
This is a charting and analysis tool. It does not make performance claims, does not predict future results, and should be used as one component of a broader decision process. Indikator

Liquidity sweep divergence (SMT) This script implements a refined version of SMT (Smart Money Technique) divergence, focused specifically on liquidity sweeps between correlated assets rather than simple structural divergence.
Use it on one market:
FOREX: EURUSD + DXY (or GBPUSD + DXY)
CRYPTO: BTC+ETH (BTC + TOTAL3, ETH + TOTAL3)
INDICES: ES + NQ
COMMODITIVES: XAU + XAG (GOLD+SILVER)
Unlike traditional SMT indicators that rely on comparing consecutive swing highs/lows (HH/LL logic), this script detects true liquidity events, where one asset takes liquidity (sweeps a previous swing) while the other fails to do so.
🔍 Core Concept
SMT divergence in this script is defined as:
Bearish SMT
The main chart sweeps a previous swing high (liquidity taken)
The second asset fails to sweep its corresponding swing high
Bullish SMT
The main chart sweeps a previous swing low
The second asset fails to do the same
This reflects asymmetry in liquidity behavior, often interpreted as a sign of weakening trend continuation and potential reversal.
⚙️ How It Works
The script uses:
1. Pivot-based swing detection
Uses confirmed pivots (ta.pivothigh / ta.pivotlow)
Eliminates noise and repaint issues from naive fractal logic
2. Cross-asset synchronization
Swings between assets are matched using a configurable bar offset tolerance
Ensures meaningful comparison between structurally aligned points
3. Liquidity sweep detection
Detects when price:
Breaks a previous swing level (high/low)
Optionally closes back inside (ICT-style wick sweep)
4. Signal filtering
To reduce false SMT signals, the script includes:
ATR-based minimum move filter
Optional wick confirmation (true liquidity grab)
No multi-swing brute-force scanning (only relevant structure is used)
🎯 What Makes This Script Unique
Focuses on liquidity sweeps, not just HH/LL divergence
Avoids common SMT noise from weak structural comparisons
Uses minimal and efficient logic (O(1)), no heavy loops
Produces clean and trade-relevant signals, not visual clutter
Designed with algorithmic trading compatibility in mind
📊 Visual Features
Clean SMT labels (Bullish / Bearish)
Optional connecting lines showing the sweep move
Background highlighting for quick contextual awareness
Transparent styling to avoid chart obstruction
⚙️ Inputs
Second Asset – symbol used for SMT comparison
Pivot Length – controls swing sensitivity
Max Sync Offset – allowed mismatch between swing points (in bars)
Wick Sweep Filter – require close back inside level (ICT-style)
ATR Filter – minimum sweep strength
Show Lines – toggle visual connections
🧠 How to Use
This indicator is best used in:
Reversal zones
Liquidity pools (equal highs/lows, prior highs/lows)
Session highs/lows (London / NY)
Typical workflow:
Identify SMT signal
Wait for confirmation:
Break of structure (BOS)
Displacement move
Execute entry in direction of SMT
⚠️ Notes
Signals appear at the moment of liquidity sweep, not at pivot formation
This script is non-repainting, as it uses confirmed pivots
SMT is not a standalone strategy — use with market structure
🌍 Дополнительно (RU — для твоей аудитории)
Этот индикатор реализует правильный SMT, основанный не на HH/LL, а на снятии ликвидности.
Ключевая идея:
Один актив забирает ликвидность (пробивает свинг)
Второй — нет
→ это и есть настоящий SMT
В отличие от большинства индикаторов:
нет мусорных сигналов
нет перебора всех свингов
используется только актуальная структура
Лучше всего работает:
на хаях/лоу сессий
на уровнях ликвидности
в связке с BOS / FVG Indikator

Indikator

MTF-Auto-Triad SMT Engine [TradeSymmetry]MTF-Auto-Triad SMT Engine
This indicator puts institutional order flow front and center, featuring an automated Multi-Timeframe (MTF) liquidity divergence engine as its core, supported by built-in helper tools for higher timeframe market structure and momentum tracking.
Built to eliminate chart clutter while maximizing actionable data, this tool is engineered for traders executing high-probability, asymmetric setups on intraday execution timeframes.
🔥 Core Feature: The SMT Engine
Stop manually typing in comparison tickers every time you switch assets. The Auto-Triad system instantly detects the asset class you are viewing and automatically scans correlated markets for Smart Money Tool (SMT) divergences across multiple timeframes simultaneously.
Supported Triads: * Indices: NQ1!, ES1!, YM1!
Forex: EURUSD, GBPUSD, DXY
Metals: XAGUSD, XAUEUR, XAUGBP, GC1!
Oil: CL1!, RB1!, HO1!
🛠 Built-In Helper Tools
1. Dynamic HTF Boxes with Time stamping
Keep your higher timeframe narrative locked in while executing on the LTF.
Live-Tracking OHLC: Project custom Higher Timeframe boxes (e.g., 1H, 4H, Daily) directly onto your execution chart.
Open Time Anchors: The Open level of your HTF box automatically pulls the exact timestamp of when that session began (e.g., 09:30 4H-OPEN), giving you crucial temporal context right at the point of execution.
2. Time-Price Velocity (TPV) Candles
Traditional candlesticks only show price action. The TPV engine colors your candles based on mathematically smoothed, ATR-normalized momentum.
Identify exactly when momentum is accelerating or decelerating inside a move.
Built-in dashboard shows live velocity metrics, trend direction, and acceleration changes.
💡 How to Use This Tool (The TradeSymmetry Setup)
This indicator is built to execute a strict, structural trading workflow. Follow these core steps:
1. Identify Your POI & Wait for the Sweep/Tap
Frame your narrative and identify your draw on liquidity. Wait patiently for price to sweep a key structural extreme (Session, Daily, Weekly, Monthly Highs/Lows, or Equal Highs/Lows). Alternatively, wait for price to tap into a high-probability Fair Value Gap (FVG) or Order Block (OB).
2. Confirm Institutional Footprints (SMT)
Once price reaches your POI, look for an SMT Divergence to print via the Auto-Triad engine. This confirms that correlated assets are failing to make the same high or low—the ultimate footprint of smart money accumulation or distribution.
3. Wait for the Shift & Open Level Validation
Look for a clear Market Structure Shift (MSS) or Change in State of Delivery (CISD).
Crucial Rule: If you are taking a bullish setup, ensure your trigger candle closes cleanly above the Open level. For a bearish setup, the candle must close cleanly below the Open level.
4. Execute the Trade
Once all criteria are met, use the momentum color shift in the TPV candles as your final entry trigger. Target asymmetric risk-to-reward setups (1:3 or 1:5 R:R) based on the next structural draw on liquidity.
⚙️ Customization
Everything is modular. Don't want the TPV colors? Turn them off. Want to use a custom 4-asset comparison instead of the Auto-Triads? Switch to Manual mode. Every line and label size can be custom-colored to fit your exact visual style.
Trade with symmetry. Indikator

SMT Divergence [UAlgo]SMT Divergence is a comparative market structure indicator designed to detect disagreement between a primary instrument and a second reference symbol. The script looks for situations where the main chart prints a stronger structural move, while the comparison symbol fails to confirm that move. This kind of disagreement is often referred to as SMT divergence and is commonly used to identify potential weakness in continuation or hidden strength into reversal conditions.
The script works by tracking confirmed swing highs and swing lows on both instruments. Once enough pivots are stored, it compares the latest structural movement in the primary chart against the latest comparable movement in the reference symbol. If the primary chart makes a lower low while the comparison symbol makes a higher low, the script identifies bullish SMT divergence. If the primary chart makes a higher high while the comparison symbol makes a lower high, the script identifies bearish SMT divergence.
What makes this script especially practical is its flexible comparison logic. It can work in a time matched mode, where the comparison swings must occur near the same bars as the primary swings, or in an independent mode, where the script simply uses the most recent valid swings from both instruments. It also supports inverse correlation logic, allowing the user to compare instruments that normally move in opposite directions.
The indicator can then display SMT labels directly on the main chart, draw structure lines between the relevant swing points, show a live information table, and optionally render the comparison symbol as candles inside the oscillator pane. This creates a complete workflow for divergence monitoring instead of only printing occasional labels.
In practical use, SMT Divergence can help traders identify moments when the primary symbol appears to be making an aggressive structural move without proper confirmation from a related market. These moments can provide useful context for potential exhaustion, liquidity events, or directional imbalance between correlated instruments.
🔹 Features
🔸 Dual Symbol Market Structure Comparison
The script compares the active chart against a second user selected symbol. Both instruments are processed using the same pivot logic, which creates a consistent framework for structural comparison.
🔸 Bullish SMT Detection
Bullish SMT is identified when the primary chart makes a lower low while the comparison symbol makes a higher low. This can suggest hidden relative strength in the comparison instrument or possible exhaustion in the primary one.
🔸 Bearish SMT Detection
Bearish SMT is identified when the primary chart makes a higher high while the comparison symbol makes a lower high. This can suggest weakening confirmation and possible vulnerability in the primary move.
🔸 Positive and Inverse Correlation Modes
The script supports both normal and inverse correlation logic. In normal mode, lows are compared with lows and highs are compared with highs. In inverse mode, lows are compared with highs and highs are compared with lows. This makes the tool flexible enough for both positively correlated and negatively correlated markets.
🔸 Time Matched and Independent Swing Modes
The user can choose whether swing comparison should require approximate time alignment or simply use the most recent valid swings from each symbol. This allows the script to be either stricter or more flexible depending on the relationship between the two markets.
🔸 Pivot Strength Control
Swing highs and lows are built from confirmed pivots using user defined left and right bar settings. This allows the user to control how sensitive or how selective the swing structure should be.
🔸 Minimum Price Difference Filter
A minimum price difference percentage can be required before a divergence is accepted. This helps avoid labeling very small and potentially insignificant swing differences.
🔸 Max Swing Memory Control
The script stores a limited number of recent swings for both the primary and comparison symbol. This keeps the logic focused on relevant structure and prevents unnecessary buildup of stale pivots.
🔸 On Chart Labels and Lines
Detected SMT events can be labeled directly on the main chart. The script can also draw structure lines across the primary and comparison swing legs used in the divergence.
🔸 Live Info Table
An information table can display the active comparison symbol, correlation mode, divergence count, and the latest signal direction. This makes the script easier to monitor in real time.
🔸 Optional Compare Candle Panel
The comparison symbol can be plotted as candles in the indicator pane. This allows the user to visually inspect whether the second instrument is confirming or rejecting the move seen in the primary chart.
🔸 Alert Support
The script includes separate alerts for bullish SMT, bearish SMT, and any SMT event.
🔹 Calculations
1) Defining Swing and Divergence Objects
type SwingPoint
int barIdx
int barTm
float price
bool isHigh
type SMTDivergence
int barIdx
int barTm
bool isBullish
float primaryPrice
float comparePrice
string primarySymbol
string compareSymbol
label lbl
line ln1
line ln2
type SymbolData
float h
float l
float c
This is the structural base of the whole script.
A SwingPoint stores one confirmed pivot with its bar index, time, price, and whether it is a high or a low.
An SMTDivergence object stores the final event once a divergence is confirmed. It keeps the primary and comparison prices, the involved symbols, the direction, and the visual references used for labels and lines.
A SymbolData object is used as a clean container for each symbol’s high, low, and close series.
So before any logic runs, the script already has a full structure for swing storage and divergence output.
2) Requesting the Comparison Symbol Data
= request.security(compareSymbolInput, timeframe.period, , lookahead = barmerge.lookahead_off)
SymbolData primaryData = SymbolData.new(high, low, close)
SymbolData compareData = SymbolData.new(compareHigh, compareLow, compareClose)
This block loads the second symbol on the same chart timeframe.
The primary chart uses the current symbol’s own high, low, and close. The comparison symbol is requested with request.security , and its values are placed into a matching data structure.
This means both symbols are analyzed on an equal timeframe basis, which is essential for consistent swing comparison.
3) Finding Pivot Highs and Pivot Lows on Both Symbols
float primaryPivotHigh = ta.pivothigh(primaryData.h, pivotLeftBars, pivotRightBars)
float primaryPivotLow = ta.pivotlow(primaryData.l, pivotLeftBars, pivotRightBars)
float comparePivotHigh = ta.pivothigh(compareData.h, pivotLeftBars, pivotRightBars)
float comparePivotLow = ta.pivotlow(compareData.l, pivotLeftBars, pivotRightBars)
This is the swing discovery engine.
The script uses the same pivot settings for both instruments. A pivot high or pivot low is only confirmed after the required number of bars has passed on each side.
This means the divergence engine is built from confirmed structure, not from temporary highs and lows that can disappear before confirmation.
4) Storing Swings in Memory
method addSwing(array swings, SwingPoint newSwing) =>
swings.push(newSwing)
if swings.size() > maxSwingsToStore
swings.shift()
swings
if not na(primaryPivotHigh)
primarySwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , primaryPivotHigh, true))
if not na(primaryPivotLow)
primarySwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , primaryPivotLow, false))
if not na(comparePivotHigh)
compareSwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , comparePivotHigh, true))
if not na(comparePivotLow)
compareSwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , comparePivotLow, false))
Once a pivot is confirmed, it is pushed into the appropriate swing array.
The true pivot bar is pivotRightBars bars in the past, so the script subtracts that offset from the current bar index and time. Each array only keeps the latest user defined number of swings.
So the script maintains a rolling structural memory for both markets without allowing the arrays to grow indefinitely.
5) Retrieving the Latest and Previous Swings
method getLastSwing(array swings, bool isHigh) =>
SwingPoint result = na
if swings.size() > 0
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
result := sw
break
result
method getPreviousSwing(array swings, bool isHigh) =>
SwingPoint result = na
int count = 0
if swings.size() > 1
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
count += 1
if count == 2
result := sw
break
result
These two helper methods are used to build the swing pairs required for divergence detection.
getLastSwing returns the most recent high or low swing of the requested type.
getPreviousSwing returns the swing before that.
This is important because SMT logic always compares two consecutive structure points on the primary side and two corresponding structure points on the comparison side.
6) Enforcing Maximum Distance Between Swing Points
method isWithinRange(SwingPoint sw1, SwingPoint sw2) =>
not na(sw1) and not na(sw2) and math.abs(sw1.barIdx - sw2.barIdx) <= maxBarsLookback
This method makes sure the two swings being compared are not too far apart in time.
If the latest and previous swing are separated by more than the allowed bar distance, the setup is ignored.
This helps keep the analysis focused on fresh and structurally related moves rather than comparing swings that are too old or too distant to be meaningful together.
7) Time Matched Swing Search
method findSwingNearBar(array swings, int targetBar, bool isHigh, int toleranceBars) =>
SwingPoint result = na
int minDiff = 999999
if swings.size() > 0
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
int diff = math.abs(sw.barIdx - targetBar)
if diff <= toleranceBars and diff < minDiff
minDiff := diff
result := sw
result
This method is used only when the user selects time matched mode.
The idea is to find a comparison symbol swing that occurred near the same bar as the primary swing. The script searches for the nearest swing of the correct type inside the allowed tolerance window.
So time matched mode is stricter because it requires approximate timing alignment between the two instruments.
8) Minimum Price Difference Filter
method pctDiff(float price1, float price2) =>
math.abs(price1 - price2) / ((price1 + price2) / 2) * 100
This function measures the percentage difference between two prices.
The result is later used as an optional minimum swing magnitude filter. If the primary chart’s new swing differs only slightly from its previous one, the script can ignore that divergence candidate.
So the minimum difference filter helps reduce weaker signals that are based on very small structure changes.
9) Bullish SMT Detection Logic
if not na(primaryPivotLow) and not na(primaryLastLow) and not na(primaryPrevLow)
SwingPoint usedCompareLast = na
SwingPoint usedComparePrev = na
bool targetSwingHigh = inverseCorrelation ? true : false
if useTimeMatching
usedCompareLast := compareSwings.findSwingNearBar(primaryLastLow.barIdx, targetSwingHigh, timeToleranceBars)
usedComparePrev := compareSwings.findSwingNearBar(primaryPrevLow.barIdx, targetSwingHigh, timeToleranceBars)
else
usedCompareLast := compareSwings.getLastSwing(targetSwingHigh)
usedComparePrev := compareSwings.getPreviousSwing(targetSwingHigh)
This is the setup stage for bullish SMT.
The script only begins the test when a new primary pivot low has just been confirmed and both the latest and previous primary lows are available.
Then it decides what kind of comparison swings are needed.
In normal correlation mode, bullish SMT compares primary lows to comparison lows.
In inverse correlation mode, bullish SMT compares primary lows to comparison highs.
Then the script either uses time matched lookup or independent swing retrieval depending on the chosen mode.
So before the bullish condition itself is tested, the script first builds the proper comparison pair according to both timing mode and correlation mode.
10) Bullish SMT Confirmation Conditions
if not na(usedCompareLast) and not na(usedComparePrev)
if primaryLastLow.isWithinRange(primaryPrevLow)
bool primaryLL = primaryLastLow.price < primaryPrevLow.price
bool compareHL = inverseCorrelation ? (usedCompareLast.price < usedComparePrev.price) : (usedCompareLast.price > usedComparePrev.price)
bool meetsMinDiff = minPriceDiff == 0.0 or (primaryLastLow.price.pctDiff(primaryPrevLow.price) >= minPriceDiff)
Bullish SMT is confirmed when three things happen.
First, the primary chart must make a lower low:
primaryLastLow.price < primaryPrevLow.price
Second, the comparison symbol must fail to confirm that weakness. In normal correlation mode this means the comparison symbol makes a higher low. In inverse correlation mode the logic is adjusted accordingly because the relationship is reversed.
Third, if the minimum difference filter is enabled, the primary low must differ enough from the previous low.
So bullish SMT is essentially a lower low in the main chart that is not properly confirmed by the comparison market.
11) Creating the Bullish Divergence Event
if primaryLL and compareHL and meetsMinDiff and primaryLastLow.barIdx != lastBullPrimaryIdx
bullishSMT := true
lastBullPrimaryIdx := primaryLastLow.barIdx
SMTDivergence newDiv = SMTDivergence.new(primaryLastLow.barIdx, primaryLastLow.barTm, true, primaryLastLow.price, usedCompareLast.price, syminfo.tickerid, compareSymbolInput, na, na, na)
newDiv.drawVisuals(primaryPrevLow.barTm, primaryPrevLow.price, usedCompareLast.barTm, usedComparePrev.barTm, usedComparePrev.price)
divergences.push(newDiv)
Once the bullish conditions are met, the script creates a new SMT divergence object.
It stores the primary swing information, the comparison swing information, the involved symbols, and the bullish direction. Then it calls the visual drawing method and pushes the divergence into the history array.
The duplicate protection check against lastBullPrimaryIdx prevents the same primary swing from being labeled repeatedly.
12) Bearish SMT Detection Logic
if not na(primaryPivotHigh) and not na(primaryLastHigh) and not na(primaryPrevHigh)
SwingPoint usedCompareLastH = na
SwingPoint usedComparePrevH = na
bool targetSwingHigh = inverseCorrelation ? false : true
if useTimeMatching
usedCompareLastH := compareSwings.findSwingNearBar(primaryLastHigh.barIdx, targetSwingHigh, timeToleranceBars)
usedComparePrevH := compareSwings.findSwingNearBar(primaryPrevHigh.barIdx, targetSwingHigh, timeToleranceBars)
else
usedCompareLastH := compareSwings.getLastSwing(targetSwingHigh)
usedComparePrevH := compareSwings.getPreviousSwing(targetSwingHigh)
This is the mirror setup stage for bearish SMT.
It begins only when a new primary pivot high has been confirmed and the required primary highs exist. Then it selects the proper comparison swing type according to the chosen correlation mode.
In normal correlation mode, bearish SMT compares highs with highs.
In inverse correlation mode, bearish SMT compares highs with lows.
So this block prepares the correct structural pair for the bearish test.
13) Bearish SMT Confirmation Conditions
if not na(usedCompareLastH) and not na(usedComparePrevH)
if primaryLastHigh.isWithinRange(primaryPrevHigh)
bool primaryHH = primaryLastHigh.price > primaryPrevHigh.price
bool compareLH = inverseCorrelation ? (usedCompareLastH.price > usedComparePrevH.price) : (usedCompareLastH.price < usedComparePrevH.price)
bool meetsMinDiff = minPriceDiff == 0.0 or (primaryLastHigh.price.pctDiff(primaryPrevHigh.price) >= minPriceDiff)
Bearish SMT is confirmed when the primary chart makes a higher high while the comparison symbol fails to confirm that strength.
In normal correlation mode, the comparison symbol must make a lower high. In inverse correlation mode the logic is adjusted to preserve the intended structural disagreement.
The minimum difference filter is applied here as well.
So bearish SMT is the opposite structure of bullish SMT, focused on unconfirmed upside continuation.
14) Creating the Bearish Divergence Event
if primaryHH and compareLH and meetsMinDiff and primaryLastHigh.barIdx != lastBearPrimaryIdx
bearishSMT := true
lastBearPrimaryIdx := primaryLastHigh.barIdx
SMTDivergence newDiv = SMTDivergence.new(primaryLastHigh.barIdx, primaryLastHigh.barTm, false, primaryLastHigh.price, usedCompareLastH.price, syminfo.tickerid, compareSymbolInput, na, na, na)
newDiv.drawVisuals(primaryPrevHigh.barTm, primaryPrevHigh.price, usedCompareLastH.barTm, usedComparePrevH.barTm, usedComparePrevH.price)
divergences.push(newDiv)
Once the bearish rules are satisfied, the script creates a bearish SMT divergence object, draws its visuals, and stores it in the divergence history array.
The duplicate protection check against lastBearPrimaryIdx prevents repeated labeling of the same primary high.
15) Drawing Labels and Lines
method drawVisuals(SMTDivergence div, int prevTime, float prevPrice, int compareTime, int prevCompareTime, float prevComparePrice) =>
if showLabels
string labelText = div.isBullish ? "🔺 SMT" : "🔻 SMT"
string tooltipText = str.format("{0} SMT Divergence {1} vs {2} Price: {3}", div.isBullish ? "Bullish" : "Bearish", div.primarySymbol, div.compareSymbol, str.tostring(div.primaryPrice, format.mintick))
color labelColor = div.isBullish ? bullishColor : bearishColor
div.lbl := label.new(div.barIdx, div.primaryPrice, labelText, xloc = xloc.bar_index, yloc = div.isBullish ? yloc.belowbar : yloc.abovebar, color = labelColor, textcolor = color.white, style = div.isBullish ? label.style_label_up : label.style_label_down, tooltip = tooltipText, size = size.small, force_overlay = true)
if showLines and not na(prevTime) and not na(prevPrice)
color lineColor = div.isBullish ? bullishColor : bearishColor
div.ln1 := line.new(prevTime, prevPrice, div.barTm, div.primaryPrice, xloc = xloc.bar_time, color = lineColor, width = 2, style = line.style_solid, force_overlay = true)
if not na(prevComparePrice) and not na(prevCompareTime) and not na(compareTime)
div.ln2 := line.new(prevCompareTime, prevComparePrice, compareTime, div.comparePrice, xloc = xloc.bar_time, color = lineColor, width = 2, style = line.style_solid)
This method creates the chart visuals for each divergence.
The label is placed directly at the primary swing location, above price for bearish SMT and below price for bullish SMT.
If line drawing is enabled, the script also draws one line across the primary chart’s two relevant swing points and another line across the comparison symbol’s swing leg.
So the user can see both the signal marker and the underlying structural disagreement that produced it.
16) Limiting Divergence History
if divergences.size() > maxDivergencesToShow
SMTDivergence rmDiv = divergences.shift()
rmDiv.cleanup()
This block controls object history.
If the stored divergence count exceeds the chosen limit, the oldest divergence is removed from the array and all its visuals are deleted.
This keeps the chart clean and prevents unlimited buildup of old labels and lines.
17) Building the Information Table
var table infoTable = table.new(position.top_right, 2, 6, bgcolor = color.new(#2222b3, 10), border_width = 1, border_color = color.new(color.white, 80), frame_width = 2, frame_color = color.new(color.white, 70))
if showTable and barstate.islast
table.cell(infoTable, 0, 1, "Primary", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 1, syminfo.tickerid, text_color = color.white, text_size = size.tiny)
table.cell(infoTable, 0, 2, "Compare", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 2, compareSymbolInput, text_color = color.white, text_size = size.tiny)
table.cell(infoTable, 0, 3, "Correlation", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 3, inverseCorrelation ? "Inverse" : "Positive", text_color = inverseCorrelation ? color.orange : color.aqua, text_size = size.tiny)
table.cell(infoTable, 0, 4, "Divergences", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 4, str.tostring(divergences.size()), text_color = color.white, text_size = size.tiny)
This table provides a compact real time summary.
It shows:
the primary symbol,
the comparison symbol,
the current correlation mode,
the number of stored divergences,
and the most recent signal direction.
So the table functions as a monitoring dashboard rather than only a decorative element.
18) Determining the Last Signal for the Table
string lastSignal = "None"
color signalColor = color.gray
if divergences.size() > 0
SMTDivergence lastDiv = divergences.get(divergences.size() - 1)
lastSignal := lastDiv.isBullish ? "🔺 Bullish" : "🔻 Bearish"
signalColor := lastDiv.isBullish ? bullishColor : bearishColor
This block determines what the table should show as the latest signal.
If at least one divergence has been stored, the script reads the newest one and displays whether it was bullish or bearish, along with the corresponding color.
So the info table always reflects the current state of the divergence history.
19) Alert Conditions
alertcondition(bullishSMT, title = "Bullish SMT Divergence", message = "🔺 Bullish SMT Divergence detected on {{ticker}}! Primary made Lower Low while {{interval}} comparison made Higher Low.")
alertcondition(bearishSMT, title = "Bearish SMT Divergence", message = "🔻 Bearish SMT Divergence detected on {{ticker}}! Primary made Higher High while {{interval}} comparison made Lower High.")
alertcondition(bullishSMT or bearishSMT, title = "Any SMT Divergence", message = "SMT Divergence detected on {{ticker}}!")
The script provides three alert types.
One triggers only on bullish SMT.
One triggers only on bearish SMT.
One triggers on any SMT event.
This makes the indicator useful both for visual study and for live event monitoring.
20) Compare Candle Panel
color compareBodyColor = compareClose >= compareOpen ? color.new(#00E676, 0) : color.new(#FF5252, 0)
color compareWickColor = compareClose >= compareOpen ? color.new(#00E676, 30) : color.new(#FF5252, 30)
color compareBorderColor = compareClose >= compareOpen ? color.new(#00C853, 0) : color.new(#D50000, 0)
plotcandle(compareOpen, compareHigh, compareLow, compareClose, title = "Compare Symbol Candles", color = compareBodyColor, wickcolor = compareWickColor, bordercolor = compareBorderColor, display = showCandlePanel ? display.all : display.none)
This block renders the comparison symbol as candles inside the indicator pane.
The candle colors are determined by the comparison symbol’s own open and close direction. If the user enables the candle panel, this gives a quick visual reference for how the second instrument is behaving without needing to open a separate chart.
So the user can study SMT signals and the comparison structure in the same pane. Indikator

SMT Divergence & ICT KillzonesOverview
This open-source indicator combines SMT-style divergence detection, ICT killzone context, and a Midnight Open reference on a single chart. It is intended for users who want to review correlation-based divergence conditions together with fixed New York session timing and a daily reference level in one workflow.
Why this script was created
This script was created to reduce the need to switch between separate tools for SMT comparison, session timing, and daily reference levels. Instead of checking these elements one by one, the indicator keeps them on the same chart so they can be reviewed together.
How it works
The script compares confirmed swing highs and lows on the chart symbol with those of a user-selected comparison symbol. When one market confirms a new swing extension while the comparison market does not confirm a similar extension, the script marks an SMT-style divergence condition.
In addition to the divergence logic, the script highlights London and New York killzone windows using fixed New York session timing and plots Midnight Open as a daily reference line.
Signals are based on confirmed pivots, so they appear after confirmation rather than on the exact turning bar.
How to use it
Choose a comparison symbol that has a meaningful relationship with the chart symbol. For example, users may compare BTCUSDT with ETHUSDT, or use other markets that are commonly reviewed together.
A practical way to use the script is to review SMT signals together with the killzone background and the Midnight Open level rather than treating the signal marker by itself as a complete trade decision.
Standard candlestick charts are recommended for visual consistency.
Inputs
Correlation Symbol — Selects the market used for SMT comparison. The most useful results usually come from symbols with a meaningful relationship to the chart symbol.
Timeframe — Sets the timeframe used for the comparison symbol. If left empty, the chart timeframe is used. Using a different timeframe changes how often comparison pivots update and can change the timing of divergence markings.
Swing Length — Controls pivot confirmation sensitivity. Higher values require more bars to confirm a pivot, which usually produces fewer signals and more delay. Lower values react faster but can produce more frequent signals.
Show Killzone Background — Shows or hides the London and New York killzone background.
Show Midnight Open — Shows or hides the Midnight Open reference line.
Display Timezone — Controls the display-related timezone behavior used where applicable. Killzone calculations remain aligned to New York session timing.
Bearish / Bullish Color — Sets the visual colors of bearish and bullish SMT markings.
Outside Killzone Transparency — Reduces the visual emphasis of signals that form outside killzone windows. Increasing this value makes off-session signals less visually prominent.
Max Historical Objects — Limits how many historical SMT drawings remain on the chart at the same time. Lower values keep the chart cleaner, while higher values preserve more historical context.
How changing the settings affects the output
Increasing Swing Length makes pivot confirmation stricter. This usually reduces the number of signals, but it also delays them further.
Lowering Swing Length makes the script react faster, but it can also increase the number of marked conditions.
Changing the Correlation Symbol changes the relationship being evaluated. Closely related markets are usually easier to interpret than unrelated ones.
Changing the Timeframe for the comparison symbol changes the pace at which comparison pivots form, which can materially change when divergence conditions appear.
Increasing Outside Killzone Transparency makes off-session signals less visually prominent.
Reducing Max Historical Objects removes older drawings sooner and keeps the chart cleaner.
Use context
This script is most useful when the chart symbol and comparison symbol have a meaningful relationship and when session timing matters in the user’s workflow. It is designed to help users review divergence conditions together with session context and a daily reference level, rather than isolate them as separate tools.
Limitations
The usefulness of the output depends heavily on the chosen comparison symbol. Weakly related or unrelated symbols can reduce the value of SMT readings.
Because the logic uses confirmed pivots, signals appear after confirmation rather than on the exact turning bar.
In sideways or choppy conditions, divergence readings can become less informative.
Heikin Ashi, Renko, Line Break, Kagi, Point & Figure, and Range charts can produce less reliable visual interpretation because they do not use standard price construction.
Design notes
This script combines confirmed SMT-style comparison logic, fixed ICT killzone timing tied to New York session hours, and a Midnight Open reference in one workflow.
It also manages historical lines and labels so the chart does not keep accumulating drawings without limit, which helps keep the visual layout more controlled over time. Indikator

ICT Concepts [UAlgo]ICT Concepts is a broad market structure toolkit that combines several core ICT style elements inside a single script. Instead of focusing on only one concept, the indicator brings together order blocks, market structure shifts, SMT divergence, fair value gaps, balanced price ranges, consequent encroachment, liquidity sweeps, Fibonacci levels, and killzones in one integrated overlay.
The script is designed for traders who want a consolidated structure map rather than a collection of separate indicators. It tracks swing highs and lows, labels structural breaks as BOS or MSS, detects order blocks from a strict candle pattern, identifies imbalances through fair value gap logic, monitors liquidity sweeps around recent pivot levels, and draws structure anchored Fibonacci levels from the latest confirmed break. It can also compare the active chart against a second symbol for SMT divergence and even render a small comparison panel directly on the chart.
One of the strongest qualities of this script is that each module is state aware. Order blocks extend until mitigation. Fair value gaps extend until price trades through them. Structure anchors update after new breaks. Killzones persist historically for a defined number of sessions. SMT events are stored, labeled, and optionally projected inside a mini comparison panel. This makes the script much more than a simple set of static drawings. It behaves like a live structural framework that evolves with price.
From a workflow point of view, the indicator is especially useful for traders who want to read context in layers. Structure tells whether price is breaking with trend or shifting against it. Order blocks and imbalances show where inefficiency or sponsorship may remain. Liquidity sweeps show where recent resting liquidity has likely been taken. Fibonacci levels frame premium, discount, equilibrium, and OTE areas relative to the latest structural move. Killzones add time based session context. Together, these components create a broad market map for discretionary analysis.
🔹 Features
🔸 Single Candle Order Block Detection
The script detects bullish and bearish order blocks using a strict three candle displacement pattern. When a valid setup appears, the order block is stored, extended forward, and removed only after mitigation. Optional mean threshold lines can also be shown inside each block.
🔸 Multi Timeframe Order Blocks
Order block detection can run on a selected timeframe through request.security . This allows higher timeframe order blocks to be projected onto the current execution chart.
🔸 Market Structure Mapping
The indicator tracks pivot highs and lows and labels confirmed structural breaks as BOS or MSS. A continuation break is labeled BOS, while a directional reversal break is labeled MSS. This gives the chart a clear structure narrative.
🔸 SMT Divergence Detection
The script can compare the active chart against a second symbol and detect SMT divergence using pivot highs and lows from both instruments. Divergences are labeled directly on the main chart and can also be reflected inside a mini comparison panel.
🔸 Fair Value Gaps
Bullish and bearish fair value gaps are detected through a classic three candle gap condition. These imbalances are stored, extended, and removed once mitigated.
🔸 Balanced Price Range Support
When a new fair value gap overlaps with an opposite side historical fair value gap, the overlapping section becomes a balanced price range. This gives the script the ability to detect conflict zones formed by opposing inefficiencies.
🔸 Consequent Encroachment Mode
The imbalance module can also be displayed in consequent encroachment mode, where the midpoint of the gap is shown along with the premium or discount half of the imbalance.
🔸 Liquidity Sweep Detection
The indicator monitors recent pivot highs and lows and marks when price trades beyond one of those levels but closes back through it. This makes it easy to spot local buy side and sell side sweeps.
🔸 Structure Anchored Fibonacci Levels
After a confirmed structural break, the script anchors Fibonacci levels between the break extreme and the opposing structural point. Equilibrium, OTE, and optional extra levels are then projected forward.
🔸 Killzone Rendering
The script can mark Asian, London, New York AM, and New York PM session windows using session boxes and optional session range lines. Historical session boxes are kept for a user defined number of prior occurrences.
🔸 Active Object Management
Each subsystem uses its own storage and cleanup logic. Order blocks, imbalances, SMT markers, liquidity sweep boxes, Fibonacci objects, and killzones are all managed so the chart remains usable over time.
🔸 Alerts
Alert conditions are included for bullish and bearish order block detection.
🔹 Calculations
1) Order Block Pattern Logic
detectLogic() =>
bool isBull = open > close and close > open and close > open and low < low and close > high
bool isBear = open < close and close < open and close < open and high > high and close < low
[isBull, high , low , time , isBear, high , low , time ]
This is the core order block detector.
A bullish order block requires:
a bearish candle at 2 ,
a bullish candle at 1 ,
a bullish current candle,
a sweep below the low of candle 2 by candle 1 ,
and a close above the high of candle 1 .
A bearish order block uses the exact inverse.
The returned zone bounds come from candle 1 , which becomes the order block candle. That is why the function returns high , low , and time .
So the script is not marking every displacement candle. It is looking for a very specific three candle formation.
2) Multi Timeframe Order Block Projection
= request.security(syminfo.tickerid, i_tf, detectLogic())
This line runs the order block detection logic on the selected timeframe.
If the user chooses a higher timeframe, the resulting order block values are projected onto the current chart. This is extremely useful for mapping higher timeframe sponsorship zones onto a lower timeframe execution environment.
So the detection can stay structurally higher while the display remains on the user’s active chart.
3) Preventing Overlapping Order Blocks
method hasOverlap(array OBs, float top, float bottom) =>
bool overlap = false
if OBs.size() > 0
for i = 0 to OBs.size() - 1
OB item = OBs.get(i)
if (top < item.top and top > item.bottom) or (bottom > item.bottom and bottom < item.top)
overlap := true
break
overlap
Before a new order block is added, the script checks whether it overlaps an existing stored block of the same side.
If the proposed top or bottom falls inside an existing block, the new one is ignored. This reduces clutter and helps avoid stacking multiple highly similar zones in the same area.
So the order block engine is selective not only in detection, but also in object creation.
4) Order Block Mitigation and Active Limit Handling
method isMitigated(OB this, float currentClose) => this.isBull ? (currentClose < this.bottom) : (currentClose > this.top)
if drawCount < OB_ACTIVE_LIMIT
if na(item.id)
item.draw(i_bullColor, "Bull OB", i_showMidLine)
item.extend()
drawCount += 1
else
item.remove()
An order block remains valid until price closes beyond its invalidation boundary.
For bullish order blocks, mitigation happens when close moves below the block bottom.
For bearish order blocks, mitigation happens when close moves above the block top.
The script also limits how many active blocks are actually drawn. Older stored blocks may remain in memory, but only the most recent valid ones stay visible. This keeps the chart clean while preserving logic continuity.
5) Market Structure Pivot Tracking
float ph = ta.pivothigh(i_structLen, i_structLen)
float pl = ta.pivotlow(i_structLen, i_structLen)
if not na(ph)
prevHigh := lastHigh
prevHighIndex := lastHighIndex
lastHigh := ph
lastHighIndex := bar_index
if not na(pl)
prevLow := lastLow
prevLowIndex := lastLowIndex
lastLow := pl
lastLowIndex := bar_index
This is the base structure engine.
The script identifies confirmed pivot highs and lows using the selected pivot length. When a new pivot is confirmed, the prior stored high or low becomes prevHigh or prevLow , and the newest one becomes lastHigh or lastLow .
This means the indicator always keeps a rolling memory of the latest structural extremes, which later become the reference levels for BOS, MSS, liquidity sweeps, and Fibonacci anchoring.
6) BOS and MSS Logic
bool brokenHigh = ta.crossover(close, lastHigh)
bool brokenLow = ta.crossunder(close, lastLow)
if brokenHigh and not na(lastHigh) and not lastHighBroken
if not trendInitialized or trendIsBullish
drawStructure(lastHighIndex, lastHigh, bar_index, lastHigh, "BOS", i_structBull, "solid")
else
drawStructure(lastHighIndex, lastHigh, bar_index, lastHigh, "MSS", i_structBull, "dashed")
if brokenLow and not na(lastLow) and not lastLowBroken
if not trendInitialized or not trendIsBullish
drawStructure(lastLowIndex, lastLow, bar_index, lastLow, "BOS", i_structBear, "solid")
else
drawStructure(lastLowIndex, lastLow, bar_index, lastLow, "MSS", i_structBear, "dashed")
This is how the script classifies structure.
If close breaks above the last confirmed high, price has broken bullish structure.
If close breaks below the last confirmed low, price has broken bearish structure.
The label depends on prior trend state.
If the break happens in the same directional regime, it is labeled BOS.
If the break happens against the prior regime, it is labeled MSS.
So BOS means continuation of prevailing structure, while MSS means a shift in directional character.
7) SMT Divergence Detection
float smtPhA = i_smtOn ? ta.pivothigh(high, i_smtLen, i_smtLen) : na
float smtPlA = i_smtOn ? ta.pivotlow(low, i_smtLen, i_smtLen) : na
float smtPhB = i_smtOn ? request.security(i_smtSymbol, timeframe.period, ta.pivothigh(high, i_smtLen, i_smtLen)) : na
float smtPlB = i_smtOn ? request.security(i_smtSymbol, timeframe.period, ta.pivotlow(low, i_smtLen, i_smtLen)) : na
This block builds pivot data for both the main symbol and the comparison symbol.
The idea of SMT is relative disagreement. If one market makes a stronger high while the other fails to confirm it, or one market makes a lower low while the other refuses to follow, divergence may be present.
The script therefore tracks pivot highs and lows separately for both instruments.
8) Bearish and Bullish SMT Conditions
bool bearishSmt = not na(smtAHighPrev) and not na(smtBHighPrev) and (smtAHighLast > smtAHighPrev) and (smtBHighLast <= smtBHighPrev)
bool bullishSmt = not na(smtALowPrev) and not na(smtBLowPrev) and (smtALowLast < smtALowPrev) and (smtBLowLast >= smtBLowPrev)
These are the actual divergence tests.
Bearish SMT occurs when the active chart makes a higher high while the comparison symbol fails to do so.
Bullish SMT occurs when the active chart makes a lower low while the comparison symbol fails to confirm that weakness.
So the script is looking for asymmetry between related instruments, which is one of the classic uses of SMT analysis.
9) Mini Panel Rendering for SMT
= request.security(i_smtSymbol, timeframe.period, )
drawMiniCandle(startX + (lookback - 1 - i), o, h, l, c, smtMin, smtRange, baseY, targetHeight, i_smtBull, i_smtBear, isBear, isBull)
The mini panel is built by requesting OHLC data for the comparison symbol, then compressing it into a custom candle panel drawn on the right side of the chart.
Each mini candle is scaled into panel coordinates using the comparison symbol’s own high and low range. SMT event bars are then marked inside that mini chart.
So the panel is not decorative only. It provides a quick structural view of the comparison symbol directly beside the main chart.
10) Fair Value Gap Detection
bool fvgBullDetected = low > high
bool fvgBearDetected = high < low
These are the fair value gap rules.
A bullish fair value gap exists when the current low is above the high from two bars ago.
A bearish fair value gap exists when the current high is below the low from two bars ago.
This is the classic three candle inefficiency model. The gap zone is then stored as an FVG object and extended forward until mitigation.
11) Balanced Price Range Logic
bool hasOverlap = fTop > existing.bottom and fBot < existing.top
if hasOverlap
float bprTop = math.min(fTop, existing.top)
float bprBot = math.max(fBot, existing.bottom)
When a newly detected fair value gap overlaps an opposite side historical fair value gap, the overlapping area becomes a balanced price range.
This is important because BPR is not detected as an isolated standalone pattern. It is formed from the intersection of opposing inefficiencies. The script extracts only the common overlapping region and stores it as a new BPR object.
So BPR here is derived from actual imbalance conflict.
12) Consequent Encroachment Logic
float ceLevel = (this.top + this.bottom) / 2
float boxTop = this.isBull ? ceLevel : this.top
float boxBot = this.isBull ? this.bottom : ceLevel
Consequent encroachment is the midpoint of the fair value gap.
The script calculates the midpoint and, when CE mode is enabled, draws both a dashed midpoint line and a half gap box. For bullish gaps it emphasizes the lower half up to midpoint. For bearish gaps it emphasizes the upper half down to midpoint.
So CE mode gives the user a more precise internal level inside the wider imbalance.
13) Fair Value Gap Mitigation
method isMitigated(FVG this, float currentHigh, float currentLow) => this.isBull ? (currentLow < this.bottom) : (currentHigh > this.top)
A bullish fair value gap is mitigated when price trades below its bottom.
A bearish fair value gap is mitigated when price trades above its top.
Once mitigation happens, the object is removed. This keeps the imbalance display focused on still relevant inefficiencies.
14) Liquidity Sweep Detection
float liqPh = ta.pivothigh(LIQ_PIVOT_LEN, 1)
float liqPl = ta.pivotlow(LIQ_PIVOT_LEN, 1)
bool sweepBull = i_showLiq and not na(liqLastLow) and not liqLastLowSwept and low < liqLastLow and close > liqLastLow
bool sweepBear = i_showLiq and not na(liqLastHigh) and not liqLastHighSwept and high > liqLastHigh and close < liqLastHigh
This module watches recent pivot highs and lows for sweep behavior.
A bullish liquidity sweep occurs when price trades below the most recent sell side liquidity level but closes back above it.
A bearish liquidity sweep occurs when price trades above the most recent buy side liquidity level but closes back below it.
This is a clean wick through and reclaim style sweep model.
15) Liquidity Sweep Box Construction
if sweepBull
line bullSweepLine = line.new(liqLastLowIndex, liqLastLow, bar_index, liqLastLow, color = i_liqSellsideCol, style = line.style_solid)
box bullSweepBox = liqNewSweepBox(liqLastLow, low, i_liqSellsideCol)
if sweepBear
line bearSweepLine = line.new(liqLastHighIndex, liqLastHigh, bar_index, liqLastHigh, color = i_liqBuysideCol, style = line.style_solid)
box bearSweepBox = liqNewSweepBox(high, liqLastHigh, i_liqBuysideCol)
When a sweep occurs, the script draws two things:
a line showing the swept liquidity level,
and a box covering the swept excursion beyond that level.
This makes the sweep visually clear by showing both the reference price and the actual penetration area.
16) Fibonacci Anchoring From Latest Structure Break
bool fibCanDraw = i_showFib and lastStructBreakDir != 0 and not na(lastStructBreakIndex) and not na(lastStructBreakExtreme) and not na(lastStructOppPrice) and not na(lastStructOppIndex) and lastStructOppIndex != 0
The Fibonacci engine only draws when a valid structural break context exists.
The anchor requires:
a known break direction,
the latest break index,
the break extreme,
the opposing structural price,
and the opposing structural index.
So Fibonacci is not anchored arbitrarily. It is tied directly to the latest confirmed structural move.
17) Fibonacci Level Calculation
float a0 = lastStructBreakExtreme
float a1 = lastStructOppPrice
float r = a1 - a0
float p0 = a0 + r * 0.0
float p1 = a0 + r * 1.0
float pEq = a0 + r * i_fibEqLevel
float pOteLow = a0 + r * i_fibOteLow
float pOteMid = a0 + r * i_fibOteMid
float pOteHigh = a0 + r * i_fibOteHigh
This is the actual Fibonacci math.
The script defines the range between the break extreme and the opposing structural point, then calculates all Fibonacci levels as proportions of that range.
That includes:
the zero level,
the one level,
equilibrium,
the OTE low,
the OTE midpoint,
and the OTE high.
Optional extra levels can also be added in the same way.
So the Fibonacci framework always adapts to the latest structural swing rather than staying fixed to older price action.
18) Killzone Session Detection
string kzTz = "UTC-5"
kzInSession(string sess) =>
not na(time(timeframe.period, sess, kzTz))
bool inAsian = kzInSession("2000-0000")
bool inLondon = kzInSession("0200-0500")
bool inNY = kzInSession("0830-1100")
bool inLondonC = kzInSession("1330-1600")
Killzones are detected through session time windows defined in UTC 5.
Each session is converted into a boolean state that says whether the current bar falls inside that time window. This becomes the input for the killzone renderer.
So session marking is time based rather than manually positioned.
19) Killzone Box and Range Update Logic
if isActive
if not wasActive or na(sBox)
sBox := box.new(left = time, top = high, right = time, bottom = low, xloc = xloc.bar_time, bgcolor = baseCol, border_color = color(na), border_width = 0, text = boxTxt, text_color = tC, text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_top)
float prevTop = box.get_top(sBox)
float prevBot = box.get_bottom(sBox)
float newTop = math.max(prevTop, high)
float newBot = math.min(prevBot, low)
box.set_top(sBox, newTop)
box.set_bottom(sBox, newBot)
box.set_right(sBox, time)
When a killzone begins, the script creates a new box using the current bar’s range. As the session continues, it keeps updating the top and bottom to reflect the highest high and lowest low made during that session.
So each killzone box becomes both a time marker and a session range marker. Indikator

SMT Divergence Strength Index [Metrify]This indicator detects SMT-style divergence between the chart symbol and a user-defined reference symbol, then filters those divergence events using a statistical strength condition. The goal is to separate ordinary pivot mismatches from divergence events that occur during unusually large relative movement between the two instruments.
It combines three components in one script: pivot-based divergence detection, Z-score normalization of momentum spread, and a correlation plot for context. The output is an oscillator panel (Z-score columns + correlation line) plus optional SMT labels/lines drawn on the main chart.
SMT divergence logic (structural layer)
The structural part of the script is based on confirmed pivots on the main symbol.
For bearish SMT detection, the script checks whether the main symbol forms a higher high while the reference symbol (evaluated at the same pivot event point) forms a lower high relative to the previous corresponding pivot event. For bullish SMT detection, it checks whether the main symbol forms a lower low while the reference symbol forms a higher low
Reference symbol and inversion
The Reference Symbol (Pairing) input defines the market used for comparison. The usefulness of the divergence output depends heavily on this pairing. The script assumes the comparison is meaningful enough that non-confirmation between the two symbols can be interpreted as a potential imbalance or relative weakness/strength event.
The 'Invert Correlation' option transforms the reference data by using reciprocal values before the divergence and correlation calculations. This can be used when analyzing pairs that are expected to move inversely (like alt to btc in specific event), so the comparison orientation better matches the intended relationship.
Invert Correlation mode (what it does and why it exists)
The Invert Correlation option changes how the reference symbol is transformed before all downstream calculations (pivot comparison, momentum spread, Z-score, and correlation plot). When enabled, the script does not compare the main symbol to the raw reference prices. Instead, it compares against the reciprocal form of the reference series:
reference high is transformed using 1 / low
reference low is transformed using 1 / high
reference close is transformed using 1 / close
This inversion is used so that an inversely related market can be analyzed in the same directional framework as a positively correlated one. In practical terms, it converts an opposite direction relationship into a comparable orientation for SMT logic. After inversion, moves that would normally appear opposite can be interpreted as if they were aligned, allowing the same higher-high / lower-high and lower-low / higher-low SMT structure rules to be applied consistently.
Conceptually, invert mode is useful when your reference asset is expected to move opposite to the main asset and you want the script to evaluate non-confirmation in a unified SMT framework. It does not automatically improve signal quality, but simply changes the orientation of the comparison so the divergence logic matches the relationship you are trying to study.
Use normal mode when the pair is usually expected to move in the same direction.
Use invert mode when the pair is usually expected to move in opposite directions (or when your analysis framework treats one as a risk-off mirror of the other).
Good inversion-pair examples (practical)
1) Risk asset vs Dollar Index (DXY)
This is one of the cleanest concepts for inversion.
BTCUSD vs DXY
ETHUSD vs DXY
OIL VS DXY
NASDAQ (NDX / US100) vs DXY
Gold vs DXY (often inverse, but can break regime)
When DXY rises, risk assets often weaken. Inverting DXY makes the reference move in the same orientation as the risk asset.
2) Equity index vs VIX
Very common inverse relationship idea.
SPX / ES / NQ vs VIX
BTC (sometimes) vs VIX as a broader risk proxy (less direct, more regime dependent)
Why inversion helps: VIX is typically "fear up when equities down". Inverted VIX can be used as a proxy for risk-on alignment.
3) USD-quoted asset vs USD strength proxy
If your main symbol is sensitive to USD strength:
XAUUSD vs DXY
EURUSD vs DXY
GBPUSD vs DXY
AUDUSD vs DXY
These are classic macro pairings where inversion often makes analytical sense.
4) Some commodity currencies vs commodity / dollar drivers (case-by-case)
Examples can work, but are more conditional:
USDCAD vs Oil (WTI) (often inverse-ish relationship via CAD/oil linkage)
AUDUSD vs Copper (sometimes)
NZDUSD vs risk proxy
These are not as stable as DXY/VIX examples, so you need to monitor correlation more carefully.
Trigger conditions in plain terms
A bearish SMT label appears only when all required conditions are satisfied:
a confirmed pivot high exists on the main symbol,
the current main pivot high is higher than the previous main pivot high,
the aligned reference high at the same pivot event is lower than its previous aligned reference high,
and the Z-score condition exceeds the configured threshold.
A bullish SMT label follows the mirrored condition/vice versa.
Display behavior and non-repaint option
The indicator uses confirmed pivots, so signals are known only after pivot confirmation. The Non repaint mode setting controls how labels are displayed:
Enabled: labels are shown on the trigger/confirmation bar (the bar where the pivot is confirmed and the signal becomes true).
Disabled: labels are shifted back to the pivot bar for visual alignment.
This setting affects visualization only. It does not change the underlying pivot confirmation process.
This indicator marks pivot-based intermarket non-confirmation events that occur during statistically elevated relative dislocation.
Pair selection remains a major source of variation in output quality. Weakly related pairs can produce divergence labels that satisfy the script’s rules but are not analytically useful. Indikator
