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提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。