OPEN-SOURCE SCRIPT
Math by Thomas SMC Swing Range + Premium/Discount Zones

Description:
"Math by Thomas โ SMC Swing Range + Premium/Discount Zones" is a Smart Money Concepts (SMC) based indicator designed to help traders visually understand market structure and value zones.
This tool automatically detects and marks:
๐บ Recent Swing Highs and Lows
๐ง Midpoint Line between swing high and low
๐ฅ๐ฉ Premium/Discount Zones for value-based entries
๐ค HH, HL, LH, LL Labels to identify trend structure
๐ BoS (Break of Structure) and CHoCH (Change of Character) confirmations
Built with Pine Script v6, this indicator is optimized for both intraday and positional traders who rely on structure-based decision-making.
๐ ๏ธ How to Use:
Apply to any chart โ Works on all timeframes and instruments.
Swing High/Low Detection:
Uses pivot logic with adjustable strength to find recent key turning points.
Displays shaded horizontal boxes for visual clarity.
Midpoint Line:
Automatically drawn between the last high and low.
Acts as the fair value level for identifying overbought/oversold zones.
Premium/Discount Zones:
Above midpoint = Premium (consider shorting).
Below midpoint = Discount (consider buying).
Structure Labels:
HH (Higher High), HL (Higher Low), LH (Lower High), LL (Lower Low).
Color-coded to reflect bullish or bearish trends.
BoS & CHoCH:
Structural breaks are labeled automatically to signal possible trend continuation or reversal.
โ๏ธ Settings:
๐ฏ Pivot Strength โ Adjusts how far back/forward candles must confirm a swing.
โ Toggle visibility of:
Swing Lines
Labels
BoS / CHoCH
Premium / Discount zones
๐จ Customize colors for each visual component.
๐ง Best Practices:
Use in combination with Order Blocks, Fair Value Gaps, or Volume Imbalances.
Ideal for traders applying Smart Money Concepts (SMC) with a structure-first mindset.
"Math by Thomas โ SMC Swing Range + Premium/Discount Zones" is a Smart Money Concepts (SMC) based indicator designed to help traders visually understand market structure and value zones.
This tool automatically detects and marks:
๐บ Recent Swing Highs and Lows
๐ง Midpoint Line between swing high and low
๐ฅ๐ฉ Premium/Discount Zones for value-based entries
๐ค HH, HL, LH, LL Labels to identify trend structure
๐ BoS (Break of Structure) and CHoCH (Change of Character) confirmations
Built with Pine Script v6, this indicator is optimized for both intraday and positional traders who rely on structure-based decision-making.
๐ ๏ธ How to Use:
Apply to any chart โ Works on all timeframes and instruments.
Swing High/Low Detection:
Uses pivot logic with adjustable strength to find recent key turning points.
Displays shaded horizontal boxes for visual clarity.
Midpoint Line:
Automatically drawn between the last high and low.
Acts as the fair value level for identifying overbought/oversold zones.
Premium/Discount Zones:
Above midpoint = Premium (consider shorting).
Below midpoint = Discount (consider buying).
Structure Labels:
HH (Higher High), HL (Higher Low), LH (Lower High), LL (Lower Low).
Color-coded to reflect bullish or bearish trends.
BoS & CHoCH:
Structural breaks are labeled automatically to signal possible trend continuation or reversal.
โ๏ธ Settings:
๐ฏ Pivot Strength โ Adjusts how far back/forward candles must confirm a swing.
โ Toggle visibility of:
Swing Lines
Labels
BoS / CHoCH
Premium / Discount zones
๐จ Customize colors for each visual component.
๐ง Best Practices:
Use in combination with Order Blocks, Fair Value Gaps, or Volume Imbalances.
Ideal for traders applying Smart Money Concepts (SMC) with a structure-first mindset.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.