OPEN-SOURCE SCRIPT
Fractal Structure Indicator BOS CHoCH TGFX

Fractal Market Structure — BOS / CHoCH
OVERVIEW
This tool maps market structure automatically using fractal pivots. It detects swing and internal structure, labels each break as BOS (continuation) or CHoCH (change of character / reversal), tracks the current fractal high and low (FH / FL), highlights the premium and discount zones of the active range, and summarises higher-timeframe structure in a table.
THE CONCEPTS
- Fractal pivots: highs and lows are detected as Williams-style pivots (a high or low with N bars on each side). Two layers are available — swing structure (larger pivots) and internal structure (smaller pivots inside the swings).
- BOS (Break of Structure): price closes beyond the prior structural point in the direction of the trend — a continuation event.
- CHoCH (Change of Character): the first break against the prevailing structure — an early sign of a potential reversal.
- Current FH / FL: the most recent fractal high and low, where liquidity tends to rest.
- Premium / Discount: the active range is split at its 50% equilibrium. Above it is premium (relatively expensive); below it is discount (relatively cheap).
- Multi-timeframe table: shows the structural bias and the zone (premium / discount) of higher timeframes at a glance.
NON-REPAINTING
A fractal is only confirmed once N bars have closed on each side, so a pivot is fixed after confirmation and does not repaint. Structure breaks (BOS / CHoCH) are evaluated on bar close.
SETTINGS
- Swing fractal length and internal fractal length.
- Show / hide internal structure.
- Show current FH / FL lines and labels.
- Show BOS / CHoCH labels.
- Show premium / discount zones.
- Colors, line extension, and the multi-timeframe table (timeframes and position).
HOW TO READ IT
- Green = bullish structure, red = bearish structure.
- BOS suggests trend continuation; CHoCH warns of a possible reversal.
- Price reaching discount within a bullish bias, or premium within a bearish bias, is the classic context many traders use to look for entries in the direction of structure.
NOTES
This script is an original implementation of standard, public price-action concepts (fractal pivots, market structure, BOS / CHoCH, premium / discount, equilibrium). It is a visualization and context tool — it does not generate buy/sell signals and makes no claim about future performance. Best used together with your own analysis and risk management.
OVERVIEW
This tool maps market structure automatically using fractal pivots. It detects swing and internal structure, labels each break as BOS (continuation) or CHoCH (change of character / reversal), tracks the current fractal high and low (FH / FL), highlights the premium and discount zones of the active range, and summarises higher-timeframe structure in a table.
THE CONCEPTS
- Fractal pivots: highs and lows are detected as Williams-style pivots (a high or low with N bars on each side). Two layers are available — swing structure (larger pivots) and internal structure (smaller pivots inside the swings).
- BOS (Break of Structure): price closes beyond the prior structural point in the direction of the trend — a continuation event.
- CHoCH (Change of Character): the first break against the prevailing structure — an early sign of a potential reversal.
- Current FH / FL: the most recent fractal high and low, where liquidity tends to rest.
- Premium / Discount: the active range is split at its 50% equilibrium. Above it is premium (relatively expensive); below it is discount (relatively cheap).
- Multi-timeframe table: shows the structural bias and the zone (premium / discount) of higher timeframes at a glance.
NON-REPAINTING
A fractal is only confirmed once N bars have closed on each side, so a pivot is fixed after confirmation and does not repaint. Structure breaks (BOS / CHoCH) are evaluated on bar close.
SETTINGS
- Swing fractal length and internal fractal length.
- Show / hide internal structure.
- Show current FH / FL lines and labels.
- Show BOS / CHoCH labels.
- Show premium / discount zones.
- Colors, line extension, and the multi-timeframe table (timeframes and position).
HOW TO READ IT
- Green = bullish structure, red = bearish structure.
- BOS suggests trend continuation; CHoCH warns of a possible reversal.
- Price reaching discount within a bullish bias, or premium within a bearish bias, is the classic context many traders use to look for entries in the direction of structure.
NOTES
This script is an original implementation of standard, public price-action concepts (fractal pivots, market structure, BOS / CHoCH, premium / discount, equilibrium). It is a visualization and context tool — it does not generate buy/sell signals and makes no claim about future performance. Best used together with your own analysis and risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。