OPEN-SOURCE SCRIPT
업데이트됨 AG Pro BOS & CHoCH Auto Detector [AGPro Series]

AG Pro BOS & CHoCH Auto Detector [AGPro Series]
OVERVIEW / WHAT IT DOES
AG Pro BOS & CHoCH Auto Detector is a market structure overlay designed to organize swing-based price action into a more readable workflow. Instead of leaving the chart covered with disconnected pivot labels or generic break markers, this script tracks structural swing progression, identifies when prior highs or lows are broken, and classifies those breaks as either BOS (Break of Structure) or CHoCH (Change of Character). The goal is not to predict the next move, but to help traders read whether price is continuing an existing structure or beginning to challenge it.
The script monitors HH, HL, LH, and LL development using pivot logic, then uses those reference points to detect structural breaks. A break in the direction of the active structure is treated as BOS, while the first meaningful break against the prior directional structure is treated as CHoCH. This distinction matters because many charts show every break in the same visual language, even though continuation and character shift do not carry the same analytical meaning. Here, those events are separated clearly.
A second layer of usefulness comes from presentation discipline. This script is built to keep structural information visible without turning the chart into a wall of labels. Swing density can be reduced, major structures can be emphasized, and the higher timeframe overlay can remain active in the background to keep local execution aligned with broader structure. The result is a structure map that stays informative without becoming visually noisy.
This tool is intended for traders who already use price structure as part of their chart reading and want a cleaner way to monitor continuation versus transition. It can support discretionary workflows around trend continuation, pullback analysis, structure failure, and higher timeframe context, while still remaining transparent about how its signals are formed.
UNIQUE EDGE
Many market structure tools stop at plotting swing points or printing BOS / CHoCH text when a level is crossed. AG Pro BOS & CHoCH Auto Detector is built around a more organized structure engine approach.
Its edge is not based on trying to forecast direction or force trade entries. Its edge is based on classification, hierarchy, and chart readability:
- It separates continuation breaks from character-change breaks instead of treating all structural violations as equivalent.
- It preserves the swing chain context behind each event, so BOS and CHoCH are not isolated labels detached from surrounding structure.
- It allows confirmation mode selection, so the user can decide whether structure breaks require close confirmation or can react to intrabar violations.
- It includes higher timeframe structure context directly on the chart rather than forcing the user to reconstruct that context manually.
- It includes swing-density controls so the visual output can be kept clean even when structure is active.
This makes the script less like a simple labeling utility and more like a workflow layer for structure-based chart reading.
METHODOLOGY
1) Swing Structure Detection
The script uses pivot-based highs and lows to identify structural reference points. Those pivots are then classified into HH, HL, LH, and LL sequences, allowing the chart to reflect whether structure is strengthening, weakening, or transitioning.
2) BOS Logic
When price breaks a prior structural level in the direction of the active trend, the event is labeled as BOS. In practical terms, this represents structural continuation rather than directional reversal.
3) CHoCH Logic
When price breaks against the previously established directional structure, the event is labeled as CHoCH. This is treated as a possible character shift, not as a guaranteed reversal. It highlights that the prior structure has been challenged.
4) Confirmation Mode
Users can choose whether structure breaks are confirmed by candle close or by intrabar price action. Close mode is more conservative and can reduce noise. Intrabar mode is more responsive and may show earlier breaks.
5) Higher Timeframe Overlay
An optional MTF layer allows the script to bring higher timeframe structure context onto the active chart. This can help users avoid reading local swings in isolation when broader structure is still dominant.
6) Visual Hierarchy
The script uses horizontal structure levels, event labels, optional arrows, controlled swing density, and a compact information panel to keep key structure events readable. The design priority is to preserve analytical clarity.
SIGNALS & ALERTS
This script can generate structure-based alerts for the following event types:
- Bullish BOS
- Bearish BOS
- Bullish CHoCH
- Bearish CHoCH
- Any structure break
These alerts are event-driven and tied to the script's structural logic. They are intended to notify the user when a relevant break occurs according to the selected confirmation mode. They are not trade instructions and should be interpreted within the user's broader process.
KEY INPUTS
Swing Pivot Length
Controls pivot sensitivity. Lower values detect swings faster but may produce more noise. Higher values are more selective.
Confirmation Mode
Choose between Close and Intrabar logic for structure break confirmation.
Max Structures to Show
Limits how many structural events remain plotted on the chart.
Swing Label Density
Lets users choose between fuller swing annotation and a cleaner major-structure view.
Max Swing Labels on Chart
Helps prevent excessive label build-up in active market conditions.
Enable MTF Overlay
Adds higher timeframe structure context to the active chart.
MTF Timeframe
Defines which higher timeframe structure layer is projected onto the chart.
Label Size / Panel Font Size / Line Settings
Allow visual tuning without changing structural logic.
LIMITATIONS & TRANSPARENCY
This script uses pivot-based structure logic. That means swing points are confirmed only after the required pivot bars are completed. Because of this, the tool is confirmation-based by design and does not attempt to label unfinished pivots as confirmed structure.
BOS and CHoCH are structural events, not certainty statements. A CHoCH may signal that the prior directional structure is being challenged, but it does not guarantee a lasting reversal. Likewise, a BOS indicates continuation within the script's structural framework, but not guaranteed follow-through.
The higher timeframe overlay is designed to add context, not to replace direct higher timeframe chart review. Users should still interpret local and higher timeframe structure together rather than relying on a single signal state.
This script is best used as a structure-mapping tool within a broader analytical framework. It is not a standalone trading system, not a predictor, and not a substitute for risk management.
RISK DISCLOSURE
This indicator is for chart analysis and educational use. It does not provide financial advice, does not guarantee outcomes, and should not be treated as a complete trading methodology on its own. Market structure tools can help organize price action, but all trading decisions remain the responsibility of the user.
OVERVIEW / WHAT IT DOES
AG Pro BOS & CHoCH Auto Detector is a market structure overlay designed to organize swing-based price action into a more readable workflow. Instead of leaving the chart covered with disconnected pivot labels or generic break markers, this script tracks structural swing progression, identifies when prior highs or lows are broken, and classifies those breaks as either BOS (Break of Structure) or CHoCH (Change of Character). The goal is not to predict the next move, but to help traders read whether price is continuing an existing structure or beginning to challenge it.
The script monitors HH, HL, LH, and LL development using pivot logic, then uses those reference points to detect structural breaks. A break in the direction of the active structure is treated as BOS, while the first meaningful break against the prior directional structure is treated as CHoCH. This distinction matters because many charts show every break in the same visual language, even though continuation and character shift do not carry the same analytical meaning. Here, those events are separated clearly.
A second layer of usefulness comes from presentation discipline. This script is built to keep structural information visible without turning the chart into a wall of labels. Swing density can be reduced, major structures can be emphasized, and the higher timeframe overlay can remain active in the background to keep local execution aligned with broader structure. The result is a structure map that stays informative without becoming visually noisy.
This tool is intended for traders who already use price structure as part of their chart reading and want a cleaner way to monitor continuation versus transition. It can support discretionary workflows around trend continuation, pullback analysis, structure failure, and higher timeframe context, while still remaining transparent about how its signals are formed.
UNIQUE EDGE
Many market structure tools stop at plotting swing points or printing BOS / CHoCH text when a level is crossed. AG Pro BOS & CHoCH Auto Detector is built around a more organized structure engine approach.
Its edge is not based on trying to forecast direction or force trade entries. Its edge is based on classification, hierarchy, and chart readability:
- It separates continuation breaks from character-change breaks instead of treating all structural violations as equivalent.
- It preserves the swing chain context behind each event, so BOS and CHoCH are not isolated labels detached from surrounding structure.
- It allows confirmation mode selection, so the user can decide whether structure breaks require close confirmation or can react to intrabar violations.
- It includes higher timeframe structure context directly on the chart rather than forcing the user to reconstruct that context manually.
- It includes swing-density controls so the visual output can be kept clean even when structure is active.
This makes the script less like a simple labeling utility and more like a workflow layer for structure-based chart reading.
METHODOLOGY
1) Swing Structure Detection
The script uses pivot-based highs and lows to identify structural reference points. Those pivots are then classified into HH, HL, LH, and LL sequences, allowing the chart to reflect whether structure is strengthening, weakening, or transitioning.
2) BOS Logic
When price breaks a prior structural level in the direction of the active trend, the event is labeled as BOS. In practical terms, this represents structural continuation rather than directional reversal.
3) CHoCH Logic
When price breaks against the previously established directional structure, the event is labeled as CHoCH. This is treated as a possible character shift, not as a guaranteed reversal. It highlights that the prior structure has been challenged.
4) Confirmation Mode
Users can choose whether structure breaks are confirmed by candle close or by intrabar price action. Close mode is more conservative and can reduce noise. Intrabar mode is more responsive and may show earlier breaks.
5) Higher Timeframe Overlay
An optional MTF layer allows the script to bring higher timeframe structure context onto the active chart. This can help users avoid reading local swings in isolation when broader structure is still dominant.
6) Visual Hierarchy
The script uses horizontal structure levels, event labels, optional arrows, controlled swing density, and a compact information panel to keep key structure events readable. The design priority is to preserve analytical clarity.
SIGNALS & ALERTS
This script can generate structure-based alerts for the following event types:
- Bullish BOS
- Bearish BOS
- Bullish CHoCH
- Bearish CHoCH
- Any structure break
These alerts are event-driven and tied to the script's structural logic. They are intended to notify the user when a relevant break occurs according to the selected confirmation mode. They are not trade instructions and should be interpreted within the user's broader process.
KEY INPUTS
Swing Pivot Length
Controls pivot sensitivity. Lower values detect swings faster but may produce more noise. Higher values are more selective.
Confirmation Mode
Choose between Close and Intrabar logic for structure break confirmation.
Max Structures to Show
Limits how many structural events remain plotted on the chart.
Swing Label Density
Lets users choose between fuller swing annotation and a cleaner major-structure view.
Max Swing Labels on Chart
Helps prevent excessive label build-up in active market conditions.
Enable MTF Overlay
Adds higher timeframe structure context to the active chart.
MTF Timeframe
Defines which higher timeframe structure layer is projected onto the chart.
Label Size / Panel Font Size / Line Settings
Allow visual tuning without changing structural logic.
LIMITATIONS & TRANSPARENCY
This script uses pivot-based structure logic. That means swing points are confirmed only after the required pivot bars are completed. Because of this, the tool is confirmation-based by design and does not attempt to label unfinished pivots as confirmed structure.
BOS and CHoCH are structural events, not certainty statements. A CHoCH may signal that the prior directional structure is being challenged, but it does not guarantee a lasting reversal. Likewise, a BOS indicates continuation within the script's structural framework, but not guaranteed follow-through.
The higher timeframe overlay is designed to add context, not to replace direct higher timeframe chart review. Users should still interpret local and higher timeframe structure together rather than relying on a single signal state.
This script is best used as a structure-mapping tool within a broader analytical framework. It is not a standalone trading system, not a predictor, and not a substitute for risk management.
RISK DISCLOSURE
This indicator is for chart analysis and educational use. It does not provide financial advice, does not guarantee outcomes, and should not be treated as a complete trading methodology on its own. Market structure tools can help organize price action, but all trading decisions remain the responsibility of the user.
릴리즈 노트
Update Notes (V1.1)This update focuses on panel standardization and visual consistency.
What changed:
- Refined the top-right information panel to match the current AG Pro panel standard.
- Rebuilt the first panel row as a single merged header row.
- Applied the standard blue header background for a cleaner and more consistent panel identity.
- Simplified the header content so the first row now displays only the script name.
- Set the default panel font size to Small for a more compact chart footprint.
- Kept the default label size at Normal.
What did not change:
- No change to BOS or CHoCH detection logic.
- No change to swing labeling logic.
- No change to MTF structure behavior.
- No change to alert conditions.
- No change to confirmation mode behavior.
Notes:
- This is a visual and layout-focused update only.
- The purpose of this revision is to improve panel readability, layout discipline, and presentation consistency without changing the analytical core of the script.
Risk Disclosure:
This script is designed for chart analysis and educational use. It does not provide financial advice and does not guarantee future results.
릴리즈 노트
Version 1.3 Update Notes- Tightened the screenshot-facing layout by reducing BOS continuation label repetition with a dedicated visual cooldown.
- Shortened BOS and CHoCH label text so structure events read faster and occupy less chart space.
- Locked Structure Memory Windows to explicit left/top/right/bottom coordinates so the projected zones stay horizontal and cleaner on-chart.
- Kept the AGPro panel standard intact while preserving the same BOS and CHoCH engine logic from the prior update.
- This pass is focused on visual polish, readability, and publish presentation rather than changing the script concept.
릴리즈 노트
🔧 UPDATE NOTES - v1.5This update focuses on chart readability and a cleaner, less crowded structure display.
The core purpose of the script remains unchanged.
This release improves how the existing market-structure logic is presented and interpreted on the chart.
This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.
------------------------
What Changed
------------------------
- Active structure memory windows now carry a centered badge
The currently active memory window displays a centered badge showing its type (Bull Shift, Bear Shift, Bull Cont, Bear Cont), so the live structural zone is clearly labeled at a glance.
- Reduced on-chart label density
Spent (invalidated or expired) memory windows are now shown as quiet faded bands without a badge, so the chart no longer accumulates overlapping labels on busy, lower-timeframe charts.
- Calmer continuation labels
The default spacing between displayed BOS continuation labels was increased, so repeated same-direction breaks no longer crowd the chart during fast sequences.
- Cleaner first-glance interpretation
Together these changes keep the focus on the most relevant structure events and the active window, while older context recedes.
------------------------
Visual Improvements
------------------------
- Labelled the active memory window while de-emphasizing spent windows
- Reduced visual clutter to enhance first-glance interpretation
- Increased default spacing between continuation labels
- Refined visual hierarchy so live structure stands out and history recedes
------------------------
Interface & Usability
------------------------
- Added an optional control for the memory-window badges
- Adjusted the default continuation-label spacing for a more balanced appearance
- Kept the existing CHoCH, swing, and HTF presentation unchanged
- Enhanced overall presentation without changing core logic
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of the script.
The goal is to improve clarity and usability, not to introduce new predictive behavior.
Users should interpret outputs the same way as before, but with a cleaner, less crowded display.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical and visualization tool.
Market conditions such as volatility, liquidity, and timeframe differences may affect how structure breaks, windows, and labels appear.
Outputs should always be interpreted within broader market context.
------------------------
Risk Reminder
------------------------
This script is for educational and analytical purposes only.
It does not provide financial advice or guaranteed trading outcomes.
Users remain responsible for their own decisions.
릴리즈 노트
🔧 UPDATE NOTES - v1.10This update focuses on turning the structure map into a decision-ready workflow:
clearer reading, graded breaks, and a real follow-through measurement, while
keeping the chart clean and uncrowded.
The core purpose of the script remains unchanged.
This release improves how the existing logic is presented, organized, and
interpreted on the chart, and adds a transparent quality and follow-through layer
on top of the same confirmed-structure detection.
This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.
------------------------
What Changed
------------------------
• Break Quality Score (0-100)
Every confirmed BOS and CHoCH is now graded from 0 to 100 using break
displacement, candle body strength, higher-timeframe alignment, and volume
thrust. The score can be shown directly on each label, so the strength of a
break is visible at a glance instead of being inferred.
• Follow-Through Tracking
The script now measures how often a confirmed break is actually followed by
directional follow-through before invalidation, and reports a real
follow-through rate in the panel. Outcomes that resolve neither way inside the
observation window are left uncounted, never scored as a failure, so the rate
stays honest.
• Next Action State
A dedicated panel row translates the current trend, last event, and break
quality into a single, plain next-action read (for example: Reversal Watch,
Trend Continuation, Confirm Shift First, or Weak Break - Wait).
• Anti-Overlap Label Engine
A collision-resolution layer keeps BOS, CHoCH, and swing labels from stacking
on top of each other or merging near equal price levels. Each new label is
scanned against a wide neighbourhood of recent labels and nudged into a clear
vertical lane. In addition, a minimum spacing is now enforced between on-chart
event labels: structure break lines are always drawn, while the text labels are
thinned in dense clusters so the chart reads cleanly at any zoom. The spacing is
adjustable, and can be turned off to label every break.
• Cleaner Panel Layout
The panel was reorganized around decision flow: Market Trend, Last Event,
Break Quality, Follow-Through, Next Action, Structure context, and Memory
Window. A Show Panel toggle was added (enabled by default).
------------------------
Visual Improvements
------------------------
• Improved chart readability by adjusting label spacing and pushing event
labels further clear of the candles.
• Reduced visual clutter to enhance first-glance interpretation, so the most
recent break and its quality stand out immediately.
• Refined visual hierarchy with luminance-aware label text, so badge text stays
readable on every color in the palette.
• Switched all event and memory-window badges to solid fills so labels stay
fully legible even when candles or zones sit directly behind them, and
verified label spacing across multiple symbols and timeframes.
• Shortened the default structure level-line projection and deepened memory
windows so horizontal level lines no longer cut across nearby labels, keeping
text crisp on lower timeframes.
• Adjusted positioning of elements to avoid overlap with candles and with each
other, including near-equal-level breaks.
------------------------
Interface & Usability
------------------------
• Optimized panel layout for a clearer information flow from context to action.
• Improved label readability for better chart interaction.
• Adjusted default visual settings for a more balanced appearance.
• Enhanced overall user experience without changing the core detection logic.
------------------------
Behavior Notes
------------------------
This update does not change the core analytical logic of how breaks and shifts
are detected.
The goal is to improve clarity, usability, and context, not to introduce new
predictive behavior. The quality score and follow-through rate are descriptive
statistics derived from the same confirmed structure.
Users should interpret outputs the same way as before, now with added context
about break strength and historical follow-through.
------------------------
Limitations Reminder
------------------------
The script remains a rule-based analytical tool.
Market conditions such as volatility, liquidity, and timeframe differences may
affect how signals appear and how follow-through resolves.
The follow-through rate is a backward-looking, sample-based statistic. It
describes past behavior on the current symbol and timeframe and is not a
forecast. Outputs should always be interpreted within broader market context.
------------------------
Risk Reminder
------------------------
This script is for educational and analytical purposes only.
It does not provide financial advice or guaranteed trading outcomes.
Users remain responsible for their own decisions.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Public-free scripts + invite-only AGPro workflows for market analysis, liquidity context, risk planning and execution review.
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
Rules-based. No hype. No guesswork.
Library & access: agprolabs.com/
Telegram: t.me/agprolabs
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.