OPEN-SOURCE SCRIPT
Market Structure (BOS on Break, HH/HL/LH/LL)

Market Structure (BOS on Break, HH/HL/LH/LL) is a clean and reactive market structure tool designed for traders who want clear visual feedback of trend direction and structure changes.
It automatically identifies:
Higher Highs (HH)
Higher Lows (HL)
Lower Highs (LH)
Lower Lows (LL)
Breaks of Structure (BOS) when price breaches previous swing levels.
✳️ Features
Automatic Structure Detection: Detects swing highs/lows based on your left/right pivot settings.
Break of Structure Alerts: Instantly updates bias when price breaks a previous swing level (no delay).
Real-Time BOS Response: Structure flips as soon as price takes out the previous high or low.
Color-Coded Bars: Bars can auto-paint white for bullish and black for bearish conditions.
Optional Fading Dots: Visual fading dots track trend duration and strength for quick bias reading.
Customizable Pivots: Choose how many bars to use for left/right swing confirmation.
Alerts: Fully configured for HH, HL, LH, LL, BOS Up, and BOS Down events.
⚙️ Inputs
Left Pivot Bars / Right Pivot Bars: Control how many candles define a valid swing point.
Paint Bars by Trend: Toggle bar coloring to match bullish or bearish bias.
Show Fading Trend Dots: Add fading dots that shrink and fade as a trend matures.
🔔 Alerts
Break of Structure Up / Down
Higher High (HH) confirmed
Higher Low (HL) confirmed
Lower High (LH) confirmed
Lower Low (LL) confirmed
🎯 Use Case
Perfect for:
Price action traders
Smart money concept (SMC) practitioners
Trend structure analysts
Scalpers and swing traders looking for quick structure flips.
🧠 Notes
Works on any timeframe and any instrument.
BOS signals update immediately when price breaks structure (no lag).
For additional BOS markers, you can uncomment the last few lines in the script to show arrows when structure breaks.
It automatically identifies:
Higher Highs (HH)
Higher Lows (HL)
Lower Highs (LH)
Lower Lows (LL)
Breaks of Structure (BOS) when price breaches previous swing levels.
✳️ Features
Automatic Structure Detection: Detects swing highs/lows based on your left/right pivot settings.
Break of Structure Alerts: Instantly updates bias when price breaks a previous swing level (no delay).
Real-Time BOS Response: Structure flips as soon as price takes out the previous high or low.
Color-Coded Bars: Bars can auto-paint white for bullish and black for bearish conditions.
Optional Fading Dots: Visual fading dots track trend duration and strength for quick bias reading.
Customizable Pivots: Choose how many bars to use for left/right swing confirmation.
Alerts: Fully configured for HH, HL, LH, LL, BOS Up, and BOS Down events.
⚙️ Inputs
Left Pivot Bars / Right Pivot Bars: Control how many candles define a valid swing point.
Paint Bars by Trend: Toggle bar coloring to match bullish or bearish bias.
Show Fading Trend Dots: Add fading dots that shrink and fade as a trend matures.
🔔 Alerts
Break of Structure Up / Down
Higher High (HH) confirmed
Higher Low (HL) confirmed
Lower High (LH) confirmed
Lower Low (LL) confirmed
🎯 Use Case
Perfect for:
Price action traders
Smart money concept (SMC) practitioners
Trend structure analysts
Scalpers and swing traders looking for quick structure flips.
🧠 Notes
Works on any timeframe and any instrument.
BOS signals update immediately when price breaks structure (no lag).
For additional BOS markers, you can uncomment the last few lines in the script to show arrows when structure breaks.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.