OPEN-SOURCE SCRIPT
SMC Structure + HTF Levels + Volatility

Description: This script is a comprehensive "Smart Money Concepts" (SMC) toolkit designed to filter out market noise and focus only on the Major Market Structure. It combines structural analysis, multi-timeframe key levels, and volatility tracking into a single chart overlay.
Unlike standard fractal indicators that clutter the chart with every minor pivot, this script uses a "Retroactive" logic system to only mark significant Higher Highs (HH), Higher Lows (HL), Lower Lows (LL), and Lower Highs (LH) that confirm a trend break.
Key Features
1. Major Structure Mapping (Retroactive Logic)
The Problem: Standard indicators often mark a "Lower High" too early, only for price to continue higher.
The Solution: This script waits for a Major Low to be broken (confirmed break of structure) before identifying the peak that caused it. It then "looks back" and retroactively labels that peak as the valid Lower High (LH).
Result: You get a clean chart that shows only the true structural legs of the trend, filtering out internal sub-swings and fake-outs.
2. Multi-Timeframe (MTF) Steplines
Automatically plots the previous highs and lows from higher timeframes:
PDH / PDL: Previous Day High & Low (Blue)
PWH / PWL: Previous Week High & Low (Orange)
PMH / PML: Previous Month High & Low (Purple)
These act as major magnet levels for price targets or reversal zones.
3. Volatility Regimes (Expansion vs. Consolidation)
Uses Bollinger Band Width to analyze market energy.
Green Background (Expansion): Volatility is above average. The market is moving fast (breakout or trend).
Gray Background (Consolidation): Volatility is below average. The market is squeezing, indicating a potential big move is building up.
How to Use It
Trend Following: Look for price to form a HL (Higher Low) in an uptrend. Wait for the background to turn Gray (Consolidation), then enter when it turns Green (Expansion) as price breaks upward.
Reversals: Watch for price to hit a PWH (Previous Week High). If a LH (Lower High) label appears shortly after, it confirms the reversal is valid.
Stop Placement: Use the most recent HL or LH labels as safe zones for stop-loss placement, as these represent protected structural points.
Settings
Swing Length: Adjusts how sensitive the structure detection is (Default: 5). Increase this number to see even longer-term structure.
Colors: Fully customizable colors for Bullish/Bearish structure, HTF lines, and Volatility zones.
Show/Hide: You can toggle off any element (like the Monthly levels or Volatility background) to keep your chart clean.
Unlike standard fractal indicators that clutter the chart with every minor pivot, this script uses a "Retroactive" logic system to only mark significant Higher Highs (HH), Higher Lows (HL), Lower Lows (LL), and Lower Highs (LH) that confirm a trend break.
Key Features
1. Major Structure Mapping (Retroactive Logic)
The Problem: Standard indicators often mark a "Lower High" too early, only for price to continue higher.
The Solution: This script waits for a Major Low to be broken (confirmed break of structure) before identifying the peak that caused it. It then "looks back" and retroactively labels that peak as the valid Lower High (LH).
Result: You get a clean chart that shows only the true structural legs of the trend, filtering out internal sub-swings and fake-outs.
2. Multi-Timeframe (MTF) Steplines
Automatically plots the previous highs and lows from higher timeframes:
PDH / PDL: Previous Day High & Low (Blue)
PWH / PWL: Previous Week High & Low (Orange)
PMH / PML: Previous Month High & Low (Purple)
These act as major magnet levels for price targets or reversal zones.
3. Volatility Regimes (Expansion vs. Consolidation)
Uses Bollinger Band Width to analyze market energy.
Green Background (Expansion): Volatility is above average. The market is moving fast (breakout or trend).
Gray Background (Consolidation): Volatility is below average. The market is squeezing, indicating a potential big move is building up.
How to Use It
Trend Following: Look for price to form a HL (Higher Low) in an uptrend. Wait for the background to turn Gray (Consolidation), then enter when it turns Green (Expansion) as price breaks upward.
Reversals: Watch for price to hit a PWH (Previous Week High). If a LH (Lower High) label appears shortly after, it confirms the reversal is valid.
Stop Placement: Use the most recent HL or LH labels as safe zones for stop-loss placement, as these represent protected structural points.
Settings
Swing Length: Adjusts how sensitive the structure detection is (Default: 5). Increase this number to see even longer-term structure.
Colors: Fully customizable colors for Bullish/Bearish structure, HTF lines, and Volatility zones.
Show/Hide: You can toggle off any element (like the Monthly levels or Volatility background) to keep your chart clean.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.