OPEN-SOURCE SCRIPT
Structure & Trend Context

Structure & Trend Context is a clean overlay that visualises market structure and trend direction without cluttering the chart. It is built as a context tool to support your own analysis, not as a signal system.
What it shows
- Trend filter: a fast and a slow EMA define the prevailing direction. The slow EMA is colour-coded by bias (up / down / neutral).
- Volatility band: an ATR band around the fast EMA gives a sense of normal price travel and dynamic over-/under-extension.
- Swing structure: the most recent confirmed swing high and swing low are tracked and drawn as reference levels.
- Structure breaks (BoS): a marker appears only when price closes beyond the prior swing by an ATR buffer while in trend. Each level is locked after it breaks, so markers stay rare and meaningful rather than firing on every minor poke.
- Context panel: a compact top-right table showing current trend bias, last higher high and last lower low.
How to use it
Read the chart first. Use the trend filter and band for context, the swing levels for reference, and treat a structure break as one piece of confluence, not a standalone trigger. Raise "Swing sensitivity" on higher timeframes or noisy assets to keep only the larger structure.
Inputs
Every layer (band, swing levels, structure markers, raw pivots, panel, bar tint) has its own toggle, and the EMA, ATR and pivot lengths are fully adjustable.
Notes
This indicator is a visualisation aid for discretionary analysis. It does not predict price, does not generate buy or sell recommendations, and is not financial advice. Markers are confirmed on bar close and do not repaint. Open-source — adapt it to your own workflow.
What it shows
- Trend filter: a fast and a slow EMA define the prevailing direction. The slow EMA is colour-coded by bias (up / down / neutral).
- Volatility band: an ATR band around the fast EMA gives a sense of normal price travel and dynamic over-/under-extension.
- Swing structure: the most recent confirmed swing high and swing low are tracked and drawn as reference levels.
- Structure breaks (BoS): a marker appears only when price closes beyond the prior swing by an ATR buffer while in trend. Each level is locked after it breaks, so markers stay rare and meaningful rather than firing on every minor poke.
- Context panel: a compact top-right table showing current trend bias, last higher high and last lower low.
How to use it
Read the chart first. Use the trend filter and band for context, the swing levels for reference, and treat a structure break as one piece of confluence, not a standalone trigger. Raise "Swing sensitivity" on higher timeframes or noisy assets to keep only the larger structure.
Inputs
Every layer (band, swing levels, structure markers, raw pivots, panel, bar tint) has its own toggle, and the EMA, ATR and pivot lengths are fully adjustable.
Notes
This indicator is a visualisation aid for discretionary analysis. It does not predict price, does not generate buy or sell recommendations, and is not financial advice. Markers are confirmed on bar close and do not repaint. Open-source — adapt it to your own workflow.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.