OPEN-SOURCE SCRIPT
Market Structure (BOS / CHOCH), Advanced & Improved

Market Structure (BOS / CHOCH)
A clean, dual-layer market structure tool that labels Break of Structure and Change of Character from a single, internally consistent trend engine, then projects the resting liquidity those swings leave behind.
The core idea
BOS and CHOCH are the same break. What separates them is direction relative to the current trend, so this script tracks one trend state and derives the label from it:
Because both signals come from one state machine, you never get contradictory labels: a break with the trend is always BOS, a break against it is always CHOCH.
Dual-layer structure
The engine runs twice at the same time:
This lets you see a minor bullish BOS unfolding inside a major downtrend, which is the context most single-length tools miss.
Liquidity pools
Every unbroken swing high (buy-side) and swing low (sell-side) is projected to the right as a resting liquidity line, and removed the moment price wicks through it. What stays on screen is only live, untaken liquidity, the levels most likely to be targeted next.
Features
Inputs
How to use
Notes
Swing pivots confirm a fixed number of bars after they print, which is inherent to all structure tools and not repainting. On the live, unclosed bar a break can update until the bar closes, so set alerts to "Once Per Bar Close" for confirmed signals.
This script is a market analysis tool, not financial advice. Always do your own research and manage risk.
A clean, dual-layer market structure tool that labels Break of Structure and Change of Character from a single, internally consistent trend engine, then projects the resting liquidity those swings leave behind.
The core idea
BOS and CHOCH are the same break. What separates them is direction relative to the current trend, so this script tracks one trend state and derives the label from it:
- BOS (Break of Structure) : price breaks a swing level in the direction of the trend. Continuation.
- CHOCH (Change of Character) : price breaks a swing level against the trend. Reversal, and it flips the trend state.
Because both signals come from one state machine, you never get contradictory labels: a break with the trend is always BOS, a break against it is always CHOCH.
Dual-layer structure
The engine runs twice at the same time:
- Swing structure (longer pivot length) : the major skeleton, drawn bold, with trailing watched-level lines and HH / HL / LH / LL swing labels.
- Internal structure (shorter pivot length) : the minor continuation breaks inside each swing leg, drawn thin and faded so they read as secondary.
This lets you see a minor bullish BOS unfolding inside a major downtrend, which is the context most single-length tools miss.
Liquidity pools
Every unbroken swing high (buy-side) and swing low (sell-side) is projected to the right as a resting liquidity line, and removed the moment price wicks through it. What stays on screen is only live, untaken liquidity, the levels most likely to be targeted next.
Features
- BOS / CHOCH detection with a single coherent trend state
- Dual-layer swing and internal structure
- Trailing lines marking the exact levels currently being watched
- HH / HL / LH / LL swing labels, color coded by structural meaning
- Buy-side and sell-side liquidity pools with auto removal on sweep
- Top-right trend table showing the swing and internal trend state
- Close or Wick break confirmation
- Eight alert conditions: swing and internal, BOS and CHOCH, bullish and bearish
Inputs
- Swing length and Internal length : pivot lookback for each layer. Lower values catch more structure, higher values show only major moves.
- Break confirmation : Close requires a close beyond the level, Wick accepts any wick beyond it.
- Toggles for BOS, CHOCH, active levels, swing labels, liquidity, internal layer and the trend table.
How to use
- Trade with the swing trend, use internal CHOCH for early reversal warnings and internal BOS for continuation entries.
- Watch the liquidity pools as targets, a sweep of one followed by a CHOCH in the opposite direction is a classic reversal setup.
- Tune the swing length to your timeframe so the major structure matches the moves you actually trade.
Notes
Swing pivots confirm a fixed number of bars after they print, which is inherent to all structure tools and not repainting. On the live, unclosed bar a break can update until the bar closes, so set alerts to "Once Per Bar Close" for confirmed signals.
This script is a market analysis tool, not financial advice. Always do your own research and manage risk.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Confluencer
Systematic & Discretionary Trader
Building precision tools for serious market analysis.
The Confluence Array — Indicator Suite for futures, crypto & forex traders.
Systematic & Discretionary Trader
Building precision tools for serious market analysis.
The Confluence Array — Indicator Suite for futures, crypto & forex traders.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Confluencer
Systematic & Discretionary Trader
Building precision tools for serious market analysis.
The Confluence Array — Indicator Suite for futures, crypto & forex traders.
Systematic & Discretionary Trader
Building precision tools for serious market analysis.
The Confluence Array — Indicator Suite for futures, crypto & forex traders.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.