OPEN-SOURCE SCRIPT
Squeeze & Structure

Title: Ultimate Squeeze & Market Structure
Description: This all-in-one trading system combines two of the most powerful concepts in technical analysis: Volatility Compression (The Squeeze) and Market Structure (SMC).
It is designed to solve the biggest problem breakout traders face: False Breakouts. By waiting for a Volatility Squeeze to release energy, and confirming it with a structural Break of Structure (BoS) or Change of Character (CHoCH), traders can identify high-probability setups with precision.
How It Works (The "Trifecta" Logic):
1. The Energy (The Squeeze): Using the classic TTM Squeeze logic, the indicator monitors the relationship between Bollinger Bands (price volatility) and Keltner Channels (average range).
Red Cloud: Volatility is compressed. The market is coiling like a spring. This is the Setup Phase.
Breakout: When price expands outside the bands, the energy is released.
2. The Structure (SMC & ZigZag): Built on a custom Non-Repainting ZigZag engine, the indicator objectively maps swing highs and lows to define the trend.
BoS (Break of Structure): Signals trend continuation. Price breaks a previous pivot in the direction of the trend.
CHoCH (Change of Character): Signals potential reversal. Price breaks a significant pivot in the opposite direction of the trend.
Ghost Line: A dotted line shows the live, developing leg of the ZigZag before it is confirmed, helping you anticipate the next pivot.
3. The Confluence (The Strategy): The most powerful signals occur when these two forces align.
Example: A Red Squeeze releases into a Bullish Breakout (Fuchsia Cloud), immediately followed by a Bullish CHoCH. This confirms that not only is volatility expanding, but the structural trend has officially reversed to the upside.
Visual Guide:
☁️ Cloud Colors (Volatility):
🟥 Red: Squeeze ON (Consolidation).
🟣 Fuchsia: Bullish Momentum Breakout.
🔵 Blue: Bearish Momentum Breakout.
🟡 Yellow: Armed/Waiting for Pullback (if Pullback mode is active).
⬜ Gray/Green: Normal Trending.
🏷️ Labels (Structure):
H / L: Confirmed Swing Highs and Lows.
BoS: Break of Structure (Trend Continuation).
CHoCH: Change of Character (Trend Reversal).
Features:
Dual Entry Modes: Choose between "Breakout" (immediate signal) or "Pullback" (waits for a retest of the midline).
Momentum Filter: Breakouts are only colored if the 20 SMA slope agrees with the direction.
Fully Customizable: Adjust ZigZag Sensitivity (Depth/Deviation), Squeeze lengths, and all colors.
Alerts: Triggers available for Squeeze Start, Breakouts, and Armed status.
Credits: This script incorporates concepts from the TTM Squeeze and standard Smart Money Concepts (SMC) market structure analysis. It uses a custom, non-repainting pivot detection algorithm to ensure historical accuracy.
Description: This all-in-one trading system combines two of the most powerful concepts in technical analysis: Volatility Compression (The Squeeze) and Market Structure (SMC).
It is designed to solve the biggest problem breakout traders face: False Breakouts. By waiting for a Volatility Squeeze to release energy, and confirming it with a structural Break of Structure (BoS) or Change of Character (CHoCH), traders can identify high-probability setups with precision.
How It Works (The "Trifecta" Logic):
1. The Energy (The Squeeze): Using the classic TTM Squeeze logic, the indicator monitors the relationship between Bollinger Bands (price volatility) and Keltner Channels (average range).
Red Cloud: Volatility is compressed. The market is coiling like a spring. This is the Setup Phase.
Breakout: When price expands outside the bands, the energy is released.
2. The Structure (SMC & ZigZag): Built on a custom Non-Repainting ZigZag engine, the indicator objectively maps swing highs and lows to define the trend.
BoS (Break of Structure): Signals trend continuation. Price breaks a previous pivot in the direction of the trend.
CHoCH (Change of Character): Signals potential reversal. Price breaks a significant pivot in the opposite direction of the trend.
Ghost Line: A dotted line shows the live, developing leg of the ZigZag before it is confirmed, helping you anticipate the next pivot.
3. The Confluence (The Strategy): The most powerful signals occur when these two forces align.
Example: A Red Squeeze releases into a Bullish Breakout (Fuchsia Cloud), immediately followed by a Bullish CHoCH. This confirms that not only is volatility expanding, but the structural trend has officially reversed to the upside.
Visual Guide:
☁️ Cloud Colors (Volatility):
🟥 Red: Squeeze ON (Consolidation).
🟣 Fuchsia: Bullish Momentum Breakout.
🔵 Blue: Bearish Momentum Breakout.
🟡 Yellow: Armed/Waiting for Pullback (if Pullback mode is active).
⬜ Gray/Green: Normal Trending.
🏷️ Labels (Structure):
H / L: Confirmed Swing Highs and Lows.
BoS: Break of Structure (Trend Continuation).
CHoCH: Change of Character (Trend Reversal).
Features:
Dual Entry Modes: Choose between "Breakout" (immediate signal) or "Pullback" (waits for a retest of the midline).
Momentum Filter: Breakouts are only colored if the 20 SMA slope agrees with the direction.
Fully Customizable: Adjust ZigZag Sensitivity (Depth/Deviation), Squeeze lengths, and all colors.
Alerts: Triggers available for Squeeze Start, Breakouts, and Armed status.
Credits: This script incorporates concepts from the TTM Squeeze and standard Smart Money Concepts (SMC) market structure analysis. It uses a custom, non-repainting pivot detection algorithm to ensure historical accuracy.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.