PROTECTED SOURCE SCRIPT
Diupdate Market Structure Pivots with BOS & CHoCH [zazenio]

What is Market Structure?
Market structure is simply the pattern of highs and lows that price creates as it moves. When you look at any chart, you'll notice price doesn't move in a straight line — it swings up, pulls back, swings up again (in an uptrend), or the opposite in a downtrend.
These swing points — the peaks and valleys — are what traders call pivots. Identifying them correctly is the foundation of understanding where a market has been and where it might go next.
What This Indicator Does
Swing Pivots automatically marks these peaks and valleys on your chart so you don't have to draw them manually. It works on any market — stocks, crypto, forex, futures, indices — and on any timeframe.
Beyond just marking pivots, this indicator also draws BOS (Break of Structure) and CHoCH (Change of Character) lines — two essential concepts that help you understand when a trend is continuing or potentially reversing.
How Pivots Are Detected
This indicator confirms pivots based on price structure, not a fixed bar count.
Here's how it works:
A swing high is confirmed when price breaks below the previous swing low. At that moment, we know the high was real — price tried to go higher, failed, and reversed. The market "proved" that level was a genuine turning point.
A swing low is confirmed when price breaks above the previous swing high. The same logic applies — price tried to go lower, failed, and reversed direction.
This creates a natural alternation: high, low, high, low. Each pivot is validated by the market's actual behavior, not by waiting for an arbitrary number of bars to pass.
Understanding BOS and CHoCH
Once you can identify pivots, the next step is understanding what happens when price breaks through them. This is where BOS and CHoCH come in.
BOS (Break of Structure)
A Break of Structure occurs when price continues in the direction of the current trend by breaking a previous pivot level.
Think of BOS as the market saying "the trend is still intact." Each BOS confirms that the dominant side (buyers or sellers) remains in control.
CHoCH (Change of Character)
A Change of Character occurs when price breaks a pivot level in the opposite direction of the current trend. This is an early warning signal that the trend may be reversing.
Think of CHoCH as the market's behavior "changing character" — it's no longer acting the way it should if the trend were healthy.
Why BOS and CHoCH Matter
These concepts give you a framework for reading what the market is actually doing:
By visualizing these breaks directly on your chart, you don't have to guess. You can see at a glance whether the market is trending smoothly (consecutive BOS) or showing signs of reversal (CHoCH).
Why This Approach Works
Most pivot indicators use a "lookback" method — they wait for a certain number of bars (say, 5 or 10) on each side of a candle before confirming it as a pivot. This creates a fixed delay. By the time the pivot appears on your chart, price has already moved on.
This indicator doesn't wait. It confirms pivots the moment price structure proves them. The result is pivots that align with how traders actually read charts — based on breaks of structure, not arbitrary countdowns.
Settings
Configuration
Pivot Settings
Structure Lines
Use Cases
━━━━━━━━━━━━━━━━━━━━━━
Version History
v1.1
v1.0
━━━━━━━━━━━━━━━━━━━━━━
Disclaimer:
This script is provided for educational and informational purposes only. It is not financial advice and does not constitute a recommendation to buy or sell any financial instrument. Always do your own research and trade at your own risk.
Market structure is simply the pattern of highs and lows that price creates as it moves. When you look at any chart, you'll notice price doesn't move in a straight line — it swings up, pulls back, swings up again (in an uptrend), or the opposite in a downtrend.
These swing points — the peaks and valleys — are what traders call pivots. Identifying them correctly is the foundation of understanding where a market has been and where it might go next.
What This Indicator Does
Swing Pivots automatically marks these peaks and valleys on your chart so you don't have to draw them manually. It works on any market — stocks, crypto, forex, futures, indices — and on any timeframe.
Beyond just marking pivots, this indicator also draws BOS (Break of Structure) and CHoCH (Change of Character) lines — two essential concepts that help you understand when a trend is continuing or potentially reversing.
How Pivots Are Detected
This indicator confirms pivots based on price structure, not a fixed bar count.
Here's how it works:
A swing high is confirmed when price breaks below the previous swing low. At that moment, we know the high was real — price tried to go higher, failed, and reversed. The market "proved" that level was a genuine turning point.
A swing low is confirmed when price breaks above the previous swing high. The same logic applies — price tried to go lower, failed, and reversed direction.
This creates a natural alternation: high, low, high, low. Each pivot is validated by the market's actual behavior, not by waiting for an arbitrary number of bars to pass.
Understanding BOS and CHoCH
Once you can identify pivots, the next step is understanding what happens when price breaks through them. This is where BOS and CHoCH come in.
BOS (Break of Structure)
A Break of Structure occurs when price continues in the direction of the current trend by breaking a previous pivot level.
- In an uptrend: Price breaks above a previous swing high → This signals strength. Buyers are pushing price to new highs, and the trend is likely to continue.
- In a downtrend: Price breaks below a previous swing low → This signals weakness. Sellers are pushing price to new lows, and the trend is likely to continue.
Think of BOS as the market saying "the trend is still intact." Each BOS confirms that the dominant side (buyers or sellers) remains in control.
CHoCH (Change of Character)
A Change of Character occurs when price breaks a pivot level in the opposite direction of the current trend. This is an early warning signal that the trend may be reversing.
- In an uptrend: Price breaks below a previous swing low → This is unexpected. In a healthy uptrend, lows should hold. When they don't, it suggests buyers are losing control and sellers may be taking over.
- In a downtrend: Price breaks above a previous swing high → This is unexpected. In a healthy downtrend, highs should hold. When they don't, it suggests sellers are losing control and buyers may be stepping in.
Think of CHoCH as the market's behavior "changing character" — it's no longer acting the way it should if the trend were healthy.
Why BOS and CHoCH Matter
These concepts give you a framework for reading what the market is actually doing:
- BOS tells you the trend is continuing — stay with it or look for entries in that direction
- CHoCH warns you the trend may be ending — time to be cautious, take profits, or look for trades in the new direction
By visualizing these breaks directly on your chart, you don't have to guess. You can see at a glance whether the market is trending smoothly (consecutive BOS) or showing signs of reversal (CHoCH).
Why This Approach Works
Most pivot indicators use a "lookback" method — they wait for a certain number of bars (say, 5 or 10) on each side of a candle before confirming it as a pivot. This creates a fixed delay. By the time the pivot appears on your chart, price has already moved on.
This indicator doesn't wait. It confirms pivots the moment price structure proves them. The result is pivots that align with how traders actually read charts — based on breaks of structure, not arbitrary countdowns.
Settings
Configuration
- Swing Width: Controls how sensitive the detection is. Higher numbers show only major swings; lower numbers capture smaller moves within the structure.
Pivot Settings
- High/Low Color: Customize the colors of swing high and swing low markers
- Style: Choose between Triangle or Circle markers
- Size: Adjust the size of pivot markers (Auto, Tiny, Small, Normal)
Structure Lines
- Show CHoCH: Toggle Change of Character lines on/off
- CHoCH Color: Customize the color of CHoCH lines
- CHoCH Label: Show/hide the "CHoCH" text label
- Show BOS: Toggle Break of Structure lines on/off
- BOS Color: Customize the color of BOS lines
- BOS Label: Show/hide the "BOS" text label
Use Cases
- See the "skeleton" of price action at a glance
- Identify potential support and resistance levels
- Understand if the market is trending or ranging
- Spot trend continuations with BOS lines
- Catch early reversal signals with CHoCH lines
- Build a foundation for more advanced trading strategies
━━━━━━━━━━━━━━━━━━━━━━
Version History
v1.1
- Added BOS (Break of Structure) lines to visualize trend continuation
- Added CHoCH (Change of Character) lines to identify potential trend reversals
- Added toggle options for BOS and CHoCH visibility
- Added customizable colors for structure lines
- Added optional labels for BOS and CHoCH
v1.0
- Initial release
- Automatic swing high and swing low detection
- Structure-based pivot confirmation (not fixed lookback)
- Customizable pivot markers (style, size, colors)
- Adjustable swing width sensitivity
━━━━━━━━━━━━━━━━━━━━━━
Disclaimer:
This script is provided for educational and informational purposes only. It is not financial advice and does not constitute a recommendation to buy or sell any financial instrument. Always do your own research and trade at your own risk.
Catatan Rilis
v1.2Wick vs Body Break Detection
Not all structure breaks are created equal. A candle that merely wicks through a level tells a different story than one that closes beyond it — and now this indicator shows you the difference at a glance.
When price breaks a pivot level, the indicator evaluates how it broke:
- Body break (solid line): Price closed beyond the level. This represents conviction. Traders committed to the move, and the candle finished on the other side. Body breaks tend to signal follow-through — the market has made its decision.
- Wick break (dashed line): Price pierced the level but closed back inside. This represents rejection or hesitation. The market tested the level, but buyers or sellers stepped in to defend it. Wick breaks often lead to retests or outright reversals.
Why does this matter? Consider a CHoCH that appears after an extended uptrend. If it's a wick break (dashed), the reversal signal is tentative — price tested the swing low but couldn't hold below it. You might wait for confirmation before acting. But if it's a body break (solid), sellers demonstrated real control by closing below the level. The reversal carries more weight.
The same logic applies to BOS. A solid BOS shows the trend continuing with momentum. A dashed BOS suggests the breakout is questionable — price poked through but couldn't commit, which often precedes a pullback to retest the level.
You can customize the line style and width for both scenarios independently, for both CHoCH and BOS lines.
Smarter Pivot Selection
Previously, when price broke structure and the indicator needed to identify the opposing pivot (for example, finding the swing low after a high break), it simply selected the lowest price in the range. This occasionally placed pivots on candles that weren't true swing points — just the absolute extreme.
Now the indicator searches for validated pivots: candles that have a higher low on both sides (for swing lows) or a lower high on both sides (for swing highs). These are actual turning points where price reversed, not just the deepest wick in a selloff.
If no validated pivot exists in the range (common in sharp V-reversals), the indicator falls back to the absolute extreme. This ensures you always get a pivot while preferring structurally meaningful ones when available.
The result is cleaner, more accurate market structure that better reflects how price actually behaved.
Consistent Label Positioning
BOS and CHoCH labels now appear at a fixed position relative to the structure line, eliminating visual inconsistencies across different price scales and timeframes.
Catatan Rilis
v1.3BOS Counter — Real-Time Trend Dashboard
Reading market structure takes focus. You need to identify pivots, track which ones have been broken, and mentally keep score of whether the trend is intact or failing. The new BOS Counter does this work for you and displays it in a simple, color-coded dashboard.
How It Works
The counter tracks Break of Structure events within the current trend:
- When a CHoCH occurs (trend reversal), the counter resets to 0
- When a BOS occurs (trend continuation), the counter increments by 1
A count of 0 means you're at the very start of a potential new trend — the CHoCH just fired. A count of 3 or higher suggests an established trend with momentum behind it. The number alone tells you how "mature" the current trend is.
The Color States — Trending vs. Consolidating at a Glance
The real power of the BOS Counter isn't just the number — it's the background color that tells you whether the trend is confirmed or in question:
Green (Bullish Confirmed): The trend is bullish AND price is currently trading above the CHoCH level. This means buyers established control with the CHoCH and have maintained it. The trend is intact and confirmed.
Red (Bearish Confirmed): The trend is bearish AND price is currently trading below the CHoCH level. Sellers established control and have maintained it. The trend is intact and confirmed.
Gray (Consolidation/Caution): This is the critical state most traders miss. It appears when price has pulled back past the CHoCH level but hasn't yet created a new CHoCH in the opposite direction.
Think about what this means: A CHoCH fired, signaling a potential trend change. But then price retraced and crossed back through that CHoCH level. The "new trend" is already being challenged before it could establish itself. This is consolidation — the market hasn't decided yet.
Why This Matters
Without the BOS Counter, identifying consolidation requires careful analysis. You'd need to remember where the last CHoCH occurred, track whether price has crossed back through it, and mentally assess whether the trend is still valid.
Now you can glance at a single element:
- Green or Red = Trend confirmed, look for setups in that direction
- Gray = Market is undecided, exercise caution or wait for resolution
This is especially valuable when scanning multiple charts or timeframes. Instead of analyzing each one, the color instantly tells you which charts have clean trends and which are choppy.
Practical Applications
Trend Following: Only take trades in the trend direction when the background is green (longs) or red (shorts). Gray means sit on your hands.
Exhaustion Warning: A high BOS count (5+) combined with the color suddenly flipping to gray suggests the trend may be exhausted. Early warning to tighten stops or take profits.
Multi-Timeframe Confirmation: Check if multiple timeframes show the same color. Alignment across timeframes = higher conviction setups.
Avoiding Chop: If the color keeps flipping between states, the market is ranging. The BOS Counter makes this obvious without needing to draw zones or guess.
Comprehensive Tooltips
Every setting in the indicator now includes detailed tooltip explanations. Hover over any input to understand exactly what it does, how it affects the chart, and how to use it effectively.
This is especially helpful for understanding:
- The difference between Close (body) and Wick break styles
- What each BOS Counter color state means
- How Swing Width affects pivot sensitivity
- When to use different line styles and widths
New users can learn the indicator's concepts directly from the settings panel, while experienced users get quick reminders without leaving TradingView.
Interface Improvements
- Line width settings now display as "Width" instead of abbreviated "W" for clarity
- All settings organized into logical groups with consistent naming
Settings Added
BOS Counter Section
- Show BOS Counter: Toggle the trend dashboard on/off
- Position: Place the counter anywhere on your chart (Left/Center/Right × Top/Middle/Bottom)
- Bullish Color: Background color when trend is bullish and confirmed (default: green)
- Bearish Color: Background color when trend is bearish and confirmed (default: red)
- Neutral Color: Background color during consolidation (default: gray)
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.