OPEN-SOURCE SCRIPT
Math by Thomas Swing Range

Math by Thomas Swing Range is a simple yet powerful tool designed to visually highlight key swing levels in the market based on a user-defined lookback period. It identifies the highest high, lowest low, and calculates the midpoint between them — creating a clear range for swing trading strategies.
These levels can help traders:
Spot potential support and resistance zones
Analyze price rejection near range boundaries
Frame mean-reversion or breakout setups
The indicator continuously updates and extends these lines into the future, making it easier to plan and manage trades with visual clarity.
🛠️ How to Use
Add to Chart:
Apply the indicator on any timeframe and asset (works best on higher timeframes like 1H, 4H, or Daily).
Configure Parameters:
Lookback Period: Number of candles used to detect the highest high and lowest low. Default is 20.
Extend Lines by N Bars: Number of future bars the levels should be projected to the right.
Interpret Lines:
🔴 Red Line: Swing High (Resistance)
🟢 Green Line: Swing Low (Support)
🔵 Blue Line: Midpoint (Mean level — useful for equilibrium-based strategies)
Trade Ideas:
Bounce trades from swing high/low zones.
Breakout confirmation if price closes strongly outside the range.
Reversion trades if price moves toward the midpoint after extreme moves.
These levels can help traders:
Spot potential support and resistance zones
Analyze price rejection near range boundaries
Frame mean-reversion or breakout setups
The indicator continuously updates and extends these lines into the future, making it easier to plan and manage trades with visual clarity.
🛠️ How to Use
Add to Chart:
Apply the indicator on any timeframe and asset (works best on higher timeframes like 1H, 4H, or Daily).
Configure Parameters:
Lookback Period: Number of candles used to detect the highest high and lowest low. Default is 20.
Extend Lines by N Bars: Number of future bars the levels should be projected to the right.
Interpret Lines:
🔴 Red Line: Swing High (Resistance)
🟢 Green Line: Swing Low (Support)
🔵 Blue Line: Midpoint (Mean level — useful for equilibrium-based strategies)
Trade Ideas:
Bounce trades from swing high/low zones.
Breakout confirmation if price closes strongly outside the range.
Reversion trades if price moves toward the midpoint after extreme moves.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.