OPEN-SOURCE SCRIPT
Market Structure (ChoCh & BOS) [identityKa]

Overview
The Market Structure (CHoCH & BOS) [identityKa] is a premium Smart Money Concepts (SMC) indicator designed to automatically track institutional market flow. Unlike basic structural indicators that only draw horizontal lines, this advanced engine identifies the precise moment the market bias shifts (CHoCH) or continues (BOS), and instantly plots the originating Order Block (OB) from which the structural break was initiated.
Core Mechanics & Terminology
The algorithm maps the market using strict pivot logic (customizable sensitivity) to filter out market noise and focus on true liquidity sweeps:
Change of Character (CHoCH): The first definitive sign of a trend reversal. Triggered when the price strictly closes above the last structural lower-high (in a downtrend) or below the last structural higher-low (in an uptrend).
Break of Structure (BOS): A continuation signal. Triggered when the price strictly closes above the last higher-high (in an uptrend) or below the last lower-low (in a downtrend), validating that the current trend remains dominant.
Auto Order Blocks (OB): This is the premium feature of the script. Whenever a valid BOS or CHoCH occurs, the engine mathematically traces back to the extreme pivot candle that caused the break. It automatically draws a highlighted Order Block zone (from the high to the low of that specific candle), projecting it forward as a highly probable area of future institutional mitigation.
HUD Dashboard & AI Logic
To streamline SMC trading, the integrated on-chart panel evaluates the active market structure and outputs a mechanical state:
Dangerous: Displayed whenever the current live price action enters an active, unmitigated Order Block (OB) zone. This acts as a critical warning that price is in a high-friction institutional area, and a violent rejection or bounce is imminent. Standard continuation trades should be avoided here.
LONG: Triggered when the macro bias is Bullish (last break was a Bullish CHoCH or BOS) and the price is comfortably outside of any active Order Block zones.
SHORT: Triggered when the macro bias is Bearish and the price is cleanly trending outside of active resistance zones.
How to Use It for Maximum Precision
SMC traders rely on patience and mitigation. When the indicator prints a new CHoCH or BOS, do not enter immediately. Instead, wait for the AI Suggestion to switch to "Dangerous" as the price pulls back into the newly formed Order Block. Once inside the box, drop to a lower timeframe to look for a micro-CHoCH confirmation, and execute your trade in the direction of the macro bias (LONG or SHORT) for explosive risk-to-reward ratios.
The Market Structure (CHoCH & BOS) [identityKa] is a premium Smart Money Concepts (SMC) indicator designed to automatically track institutional market flow. Unlike basic structural indicators that only draw horizontal lines, this advanced engine identifies the precise moment the market bias shifts (CHoCH) or continues (BOS), and instantly plots the originating Order Block (OB) from which the structural break was initiated.
Core Mechanics & Terminology
The algorithm maps the market using strict pivot logic (customizable sensitivity) to filter out market noise and focus on true liquidity sweeps:
Change of Character (CHoCH): The first definitive sign of a trend reversal. Triggered when the price strictly closes above the last structural lower-high (in a downtrend) or below the last structural higher-low (in an uptrend).
Break of Structure (BOS): A continuation signal. Triggered when the price strictly closes above the last higher-high (in an uptrend) or below the last lower-low (in a downtrend), validating that the current trend remains dominant.
Auto Order Blocks (OB): This is the premium feature of the script. Whenever a valid BOS or CHoCH occurs, the engine mathematically traces back to the extreme pivot candle that caused the break. It automatically draws a highlighted Order Block zone (from the high to the low of that specific candle), projecting it forward as a highly probable area of future institutional mitigation.
HUD Dashboard & AI Logic
To streamline SMC trading, the integrated on-chart panel evaluates the active market structure and outputs a mechanical state:
Dangerous: Displayed whenever the current live price action enters an active, unmitigated Order Block (OB) zone. This acts as a critical warning that price is in a high-friction institutional area, and a violent rejection or bounce is imminent. Standard continuation trades should be avoided here.
LONG: Triggered when the macro bias is Bullish (last break was a Bullish CHoCH or BOS) and the price is comfortably outside of any active Order Block zones.
SHORT: Triggered when the macro bias is Bearish and the price is cleanly trending outside of active resistance zones.
How to Use It for Maximum Precision
SMC traders rely on patience and mitigation. When the indicator prints a new CHoCH or BOS, do not enter immediately. Instead, wait for the AI Suggestion to switch to "Dangerous" as the price pulls back into the newly formed Order Block. Once inside the box, drop to a lower timeframe to look for a micro-CHoCH confirmation, and execute your trade in the direction of the macro bias (LONG or SHORT) for explosive risk-to-reward ratios.
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.