OPEN-SOURCE SCRIPT
Cập nhật Market Structure CH / BOS

Market Structure CH / BOS
Automatic intraday market structure mapping — Change of Character (CH) and Break of Structure (BOS) — built for the New York regular session.
This indicator tracks the live trend structure of any intraday chart using a state machine that follows two key levels at all times:
BOS (Break of Structure): the most recent structural extreme in the direction of the trend. A close beyond it confirms trend continuation.
CH (Change of Character): the origin of the current impulse. A close beyond it flips the structure to the opposite direction.
In a bearish structure the CH sits above and the BOS below; in a bullish structure it's mirrored.
How it works
Closes only. Wicks never break a level — only a confirmed candle close validates a BOS or a CH break. Nothing is decided on the in-progress candle.
Daily reset. The indicator works exclusively during the 09:30–15:59 New York regular session. The 09:30 candle sets the initial range, logic starts at 09:31, and everything is cleared and reinitialized at the next day's open. Outside the session, structure and drawings freeze.
Initialization. While direction is undefined, the day's running high/low are tracked. The first close below the opening low starts a bearish structure (and the first close above the opening high, a bullish one).
Continuation (BOS break): the BOS moves to the new extreme. The CH only advances if the prior pullback was significant.
Flip (CH break): the structure reverses, and the new CH is anchored to the absolute extreme of the finished phase — where the reversal impulse was actually born.
Minimum Pullback Filter
A standout feature: the Minimum Retracement (%) input. Small, single-candle dips inside the same impulse used to drag the CH around incorrectly. This filter measures each pullback as a percentage of the CH→BOS leg and only moves the CH when the retracement is real:
A ~63% rebound → moves the CH.
A ~20% dip → ignored as noise.
Configurable from 10% to 90% (default 35%).
Inputs
Regular session — session window (default 0930–1600 NY).
CH / BOS colors and line thickness (1–4).
Line extension — how many candles forward the levels project (default 15).
Minimum retracement (%) — the pullback filter described above.
Notes
Designed for intraday timeframes only.
Only the active CH/BOS pair is shown; previous levels are removed to keep the chart clean.
Times are fixed to the America/New_York timezone regardless of your chart's local time.
Automatic intraday market structure mapping — Change of Character (CH) and Break of Structure (BOS) — built for the New York regular session.
This indicator tracks the live trend structure of any intraday chart using a state machine that follows two key levels at all times:
BOS (Break of Structure): the most recent structural extreme in the direction of the trend. A close beyond it confirms trend continuation.
CH (Change of Character): the origin of the current impulse. A close beyond it flips the structure to the opposite direction.
In a bearish structure the CH sits above and the BOS below; in a bullish structure it's mirrored.
How it works
Closes only. Wicks never break a level — only a confirmed candle close validates a BOS or a CH break. Nothing is decided on the in-progress candle.
Daily reset. The indicator works exclusively during the 09:30–15:59 New York regular session. The 09:30 candle sets the initial range, logic starts at 09:31, and everything is cleared and reinitialized at the next day's open. Outside the session, structure and drawings freeze.
Initialization. While direction is undefined, the day's running high/low are tracked. The first close below the opening low starts a bearish structure (and the first close above the opening high, a bullish one).
Continuation (BOS break): the BOS moves to the new extreme. The CH only advances if the prior pullback was significant.
Flip (CH break): the structure reverses, and the new CH is anchored to the absolute extreme of the finished phase — where the reversal impulse was actually born.
Minimum Pullback Filter
A standout feature: the Minimum Retracement (%) input. Small, single-candle dips inside the same impulse used to drag the CH around incorrectly. This filter measures each pullback as a percentage of the CH→BOS leg and only moves the CH when the retracement is real:
A ~63% rebound → moves the CH.
A ~20% dip → ignored as noise.
Configurable from 10% to 90% (default 35%).
Inputs
Regular session — session window (default 0930–1600 NY).
CH / BOS colors and line thickness (1–4).
Line extension — how many candles forward the levels project (default 15).
Minimum retracement (%) — the pullback filter described above.
Notes
Designed for intraday timeframes only.
Only the active CH/BOS pair is shown; previous levels are removed to keep the chart clean.
Times are fixed to the America/New_York timezone regardless of your chart's local time.
Phát hành các Ghi chú
Settings in englishPhát hành các Ghi chú
Added time zone as inputPhát hành các Ghi chú
little fixPhát hành các Ghi chú
Update in timezonePhát hành các Ghi chú
fixMã 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.