OPEN-SOURCE SCRIPT
Smart Money Concepts - Regime-Adaptive SMC [Dots3Red]

█ SMART MONEY CONCEPTS — REGIME-ADAPTIVE SMC
This indicator attempts to bridge a gap that most SMC traders encounter in practice: the same pattern — an Order Block, a Fair Value Gap, a structure break — behaves differently depending on whether the market is trending or ranging. A bullish Order Block in a trending market is a continuation entry zone. The same pattern near the top of a range is a reversal signal. This script uses a built-in regime classifier to determine the current market character on every bar, then filters and interprets each SMC concept accordingly.
█ HOW THE REGIME CLASSIFIER WORKS
Three measurements are combined into a single trend score on every bar:
ADX (Average Directional Index) measures how strongly price is committed to a direction. It is normalized from its natural 0–60 range to a 0–1 scale by dividing by 60.
Choppiness Index measures directional efficiency — how much of price movement was "wasted" going sideways versus producing net progress. It is inverted so that high choppiness produces a low score. Near 38 (the Fibonacci trend boundary) the normalized value approaches 1.0. Near 100 (pure chop) it approaches 0.0.
The two values are averaged:
trend_score = (adx_normalized + choppiness_inverted_normalized) / 2
A score above 0.6 identifies a trending market. A score below 0.6 identifies a ranging market.
Volatility override: a separate check compares current ATR against its 50-bar SMA. If the ratio exceeds 1.5× the baseline, the regime switches to VOLATILE regardless of the trend score — because during genuine volatility expansion, both trend and reversal signals become unreliable.
Finally, a mode filter examines the last 6 raw regime values and returns the most frequent one. This prevents the regime from flickering on borderline readings.
█ WHAT EACH REGIME SHOWS
TRENDING (cyan bars): Market is moving directionally. Shows BOS labels confirming continuation, Order Blocks created at displacement-qualified BOS bars as continuation entry zones, and Fair Value Gaps as pullback targets in the trend direction. CHoCH signals are hidden — in a trend, CHoCH is usually a deep pullback, not a reversal.
RANGING (magenta bars): Market is oscillating between levels. Shows CHoCH labels flagging potential reversals at range extremes, Order Blocks at CHoCH bars as reversal entry zones, and Fair Value Gaps near range boundaries. BOS signals are hidden — a structure break in a ranging market is usually a liquidity sweep, not a genuine breakout.
VOLATILE (amber bars): ATR has expanded significantly above its baseline — earnings, macro events, sudden liquidations. Order Blocks and FVGs are suppressed because zones created during volatility spikes are historically unreliable. Structure labels (BOS) remain visible for position tracking only.
UNCERTAIN (slate bars): The classifier cannot confidently assign a regime. All signals are displayed so the trader has maximum information. This state occurs during the warmup period and at genuine transition boundaries.
█ ORDER BLOCK DETECTION
Order Blocks require an additional displacement filter before they are created. The body of the candle immediately before the BOS or CHoCH must exceed 0.8× ATR in absolute size. This ensures only candles with institutional-grade momentum qualify — eliminating the low-quality OBs that make most SMC scripts visually cluttered.
Mitigation uses standard ICT methodology: a bullish OB is consumed when price's low touches the top of the zone. A bearish OB is consumed when price's high touches the bottom of the zone. Consumed zones fade visually and stop extending.
█ FAIR VALUE GAP DETECTION
A bullish FVG exists when the high of candle[2] is below the low of candle[0] — a genuine three-candle imbalance where price moved too fast to fill. A minimum size filter of 0.15× ATR removes noise gaps. FVGs extend forward until price enters the gap, at which point they fade and stop tracking.
█ PREMIUM / DISCOUNT ZONES
Two horizontal lines divide the current 25-bar swing range:
• 75% level (red): price is in the upper quartile of the recent range — statistically expensive. In ranging markets this is a sell consideration zone.
• 25% level (green): price is in the lower quartile — statistically cheap. In ranging markets this is a buy consideration zone.
The HUD displays the current percentage position within the range in real time.
█ SMC BIAS MATRIX
The HUD includes a composite directional score built from three components:
• Structural trend (35 points): which direction is the structural_trend state machine currently pointing
• Premium / Discount position (30 points): which side of the range is price on
• Regime alignment (35 points): does the regime confirm the directional bias
In VOLATILE and UNCERTAIN regimes the bias is forced to 50% and displays "STAND ASIDE" or "WAIT FOR REGIME" — because the script suppresses OB and FVG signals in those states, showing a directional bias would contradict its own logic.
█ WHAT YOU SEE ON THE CHART
• Bar colors: every bar is tinted by the current regime — cyan (trending), magenta (ranging), amber (volatile), slate (uncertain). No labels or background fills — just the candles themselves change color, keeping the chart clean.
• BOS / CHoCH labels: small labels appear above swing highs (bullish breaks) or below swing lows (bearish breaks), offset by 1.5× ATR so they never overlap candle bodies.
• Order Block boxes: semi-transparent boxes that extend bar by bar until mitigated, then fade. Maximum 4 per direction.
• FVG boxes: thin semi-transparent boxes extending until filled, then fading. Minimum size filtered.
• Premium/Discount lines: two step-lines showing the 75% and 25% boundaries of the current swing range.
• HUD: regime state, confidence bar, bias matrix, P/D zone, ADX, Choppiness Index, ATR ratio, and live counts of active OBs and FVGs.
█ ALERTS
Seven alert conditions are available: Bull BOS, Bear BOS, Bull CHoCH, Bear CHoCH, Regime → Trending, Regime → Ranging, Regime → Volatile.
█ NOTES ON SETTINGS
• Regime Smoothing Filter: 5–7 for intraday charts, 8–12 for daily/weekly. Lower values react faster but produce more regime transitions.
• Volatile ATR Mult: 1.8–2.0 for stock indices (earnings create genuine 2× spikes), 1.4–1.6 for crypto and forex.
• OB Displacement Mult: 0.5–0.8 for daily charts where candles are naturally larger, 1.0–1.5 for intraday.
• Swing Pivot Length: 5–7 for intraday, 7–10 for daily/weekly.
█ DISCLAIMER
This indicator is a technical analysis tool. It does not constitute financial advice and does not guarantee future results. Past patterns do not predict future price behavior. Use appropriate risk management on all trades.
This indicator attempts to bridge a gap that most SMC traders encounter in practice: the same pattern — an Order Block, a Fair Value Gap, a structure break — behaves differently depending on whether the market is trending or ranging. A bullish Order Block in a trending market is a continuation entry zone. The same pattern near the top of a range is a reversal signal. This script uses a built-in regime classifier to determine the current market character on every bar, then filters and interprets each SMC concept accordingly.
█ HOW THE REGIME CLASSIFIER WORKS
Three measurements are combined into a single trend score on every bar:
ADX (Average Directional Index) measures how strongly price is committed to a direction. It is normalized from its natural 0–60 range to a 0–1 scale by dividing by 60.
Choppiness Index measures directional efficiency — how much of price movement was "wasted" going sideways versus producing net progress. It is inverted so that high choppiness produces a low score. Near 38 (the Fibonacci trend boundary) the normalized value approaches 1.0. Near 100 (pure chop) it approaches 0.0.
The two values are averaged:
trend_score = (adx_normalized + choppiness_inverted_normalized) / 2
A score above 0.6 identifies a trending market. A score below 0.6 identifies a ranging market.
Volatility override: a separate check compares current ATR against its 50-bar SMA. If the ratio exceeds 1.5× the baseline, the regime switches to VOLATILE regardless of the trend score — because during genuine volatility expansion, both trend and reversal signals become unreliable.
Finally, a mode filter examines the last 6 raw regime values and returns the most frequent one. This prevents the regime from flickering on borderline readings.
█ WHAT EACH REGIME SHOWS
TRENDING (cyan bars): Market is moving directionally. Shows BOS labels confirming continuation, Order Blocks created at displacement-qualified BOS bars as continuation entry zones, and Fair Value Gaps as pullback targets in the trend direction. CHoCH signals are hidden — in a trend, CHoCH is usually a deep pullback, not a reversal.
RANGING (magenta bars): Market is oscillating between levels. Shows CHoCH labels flagging potential reversals at range extremes, Order Blocks at CHoCH bars as reversal entry zones, and Fair Value Gaps near range boundaries. BOS signals are hidden — a structure break in a ranging market is usually a liquidity sweep, not a genuine breakout.
VOLATILE (amber bars): ATR has expanded significantly above its baseline — earnings, macro events, sudden liquidations. Order Blocks and FVGs are suppressed because zones created during volatility spikes are historically unreliable. Structure labels (BOS) remain visible for position tracking only.
UNCERTAIN (slate bars): The classifier cannot confidently assign a regime. All signals are displayed so the trader has maximum information. This state occurs during the warmup period and at genuine transition boundaries.
█ ORDER BLOCK DETECTION
Order Blocks require an additional displacement filter before they are created. The body of the candle immediately before the BOS or CHoCH must exceed 0.8× ATR in absolute size. This ensures only candles with institutional-grade momentum qualify — eliminating the low-quality OBs that make most SMC scripts visually cluttered.
Mitigation uses standard ICT methodology: a bullish OB is consumed when price's low touches the top of the zone. A bearish OB is consumed when price's high touches the bottom of the zone. Consumed zones fade visually and stop extending.
█ FAIR VALUE GAP DETECTION
A bullish FVG exists when the high of candle[2] is below the low of candle[0] — a genuine three-candle imbalance where price moved too fast to fill. A minimum size filter of 0.15× ATR removes noise gaps. FVGs extend forward until price enters the gap, at which point they fade and stop tracking.
█ PREMIUM / DISCOUNT ZONES
Two horizontal lines divide the current 25-bar swing range:
• 75% level (red): price is in the upper quartile of the recent range — statistically expensive. In ranging markets this is a sell consideration zone.
• 25% level (green): price is in the lower quartile — statistically cheap. In ranging markets this is a buy consideration zone.
The HUD displays the current percentage position within the range in real time.
█ SMC BIAS MATRIX
The HUD includes a composite directional score built from three components:
• Structural trend (35 points): which direction is the structural_trend state machine currently pointing
• Premium / Discount position (30 points): which side of the range is price on
• Regime alignment (35 points): does the regime confirm the directional bias
In VOLATILE and UNCERTAIN regimes the bias is forced to 50% and displays "STAND ASIDE" or "WAIT FOR REGIME" — because the script suppresses OB and FVG signals in those states, showing a directional bias would contradict its own logic.
█ WHAT YOU SEE ON THE CHART
• Bar colors: every bar is tinted by the current regime — cyan (trending), magenta (ranging), amber (volatile), slate (uncertain). No labels or background fills — just the candles themselves change color, keeping the chart clean.
• BOS / CHoCH labels: small labels appear above swing highs (bullish breaks) or below swing lows (bearish breaks), offset by 1.5× ATR so they never overlap candle bodies.
• Order Block boxes: semi-transparent boxes that extend bar by bar until mitigated, then fade. Maximum 4 per direction.
• FVG boxes: thin semi-transparent boxes extending until filled, then fading. Minimum size filtered.
• Premium/Discount lines: two step-lines showing the 75% and 25% boundaries of the current swing range.
• HUD: regime state, confidence bar, bias matrix, P/D zone, ADX, Choppiness Index, ATR ratio, and live counts of active OBs and FVGs.
█ ALERTS
Seven alert conditions are available: Bull BOS, Bear BOS, Bull CHoCH, Bear CHoCH, Regime → Trending, Regime → Ranging, Regime → Volatile.
█ NOTES ON SETTINGS
• Regime Smoothing Filter: 5–7 for intraday charts, 8–12 for daily/weekly. Lower values react faster but produce more regime transitions.
• Volatile ATR Mult: 1.8–2.0 for stock indices (earnings create genuine 2× spikes), 1.4–1.6 for crypto and forex.
• OB Displacement Mult: 0.5–0.8 for daily charts where candles are naturally larger, 1.0–1.5 for intraday.
• Swing Pivot Length: 5–7 for intraday, 7–10 for daily/weekly.
█ DISCLAIMER
This indicator is a technical analysis tool. It does not constitute financial advice and does not guarantee future results. Past patterns do not predict future price behavior. Use appropriate risk management on all trades.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Connect the dots to elevate your trading.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Connect the dots to elevate your trading.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.