OPEN-SOURCE SCRIPT
Enhanced ATR Supertrend

Enhanced ATR Supertrend - Mathematically Sound Trend Following Indicator
OVERVIEW
This is a premium version of the classic Supertrend indicator, built with mathematical rigor and enhanced features for serious traders. Unlike basic implementations, this version offers proper band trailing logic, adaptive volatility modes, and multiple ATR calculation methods.
HOW IT WORKS
The Enhanced ATR Supertrend calculates dynamic support and resistance bands based on the Average True Range (ATR). The core principle is simple but powerful:
ATR Calculation: Measures market volatility using true range (the greatest of: high-low, high-previous close, or low-previous close)
Band Construction: Creates upper and lower bands by adding/subtracting ATR × Multiplier from the HL2 (high+low average)
Trailing Logic:
Upper band can ONLY move down or stay flat (never up) during downtrends
Lower band can ONLY move up or stay flat (never down) during uptrends
This prevents premature trend reversals and whipsaws
Trend Determination:
BULLISH when price closes above the upper band
BEARISH when price closes below the lower band
Line colour changes reflect current trend state
WHY IT'S BETTER
Proper Mathematics: Correct band trailing prevents the "flickering" seen in poorly coded versions
Adaptive Volatility: Optional mode adjusts multiplier based on current vs average volatility - tightens in chaos, widens in calm markets
Multiple ATR Methods: Choose between RMA (default), SMA, EMA, or WMA smoothing
Clean Visual Design: Professional presentation with optional dashboard showing real-time metrics
OSCILLATOR MODE - SPOTTING DOUBLE TOPS/BOTTOMS
When used as an oscillator in the lower pane (remove overlay), the Supertrend's trend changes can reveal powerful reversal patterns:
Double Bottoms: When the indicator flips bullish twice at similar price levels, it often signals strong support and potential reversal zones
Double Tops: When the indicator flips bearish twice at similar levels, it identifies resistance and potential breakdown zones
The step-like visualization makes these patterns easier to spot than traditional price action
OVERVIEW
This is a premium version of the classic Supertrend indicator, built with mathematical rigor and enhanced features for serious traders. Unlike basic implementations, this version offers proper band trailing logic, adaptive volatility modes, and multiple ATR calculation methods.
HOW IT WORKS
The Enhanced ATR Supertrend calculates dynamic support and resistance bands based on the Average True Range (ATR). The core principle is simple but powerful:
ATR Calculation: Measures market volatility using true range (the greatest of: high-low, high-previous close, or low-previous close)
Band Construction: Creates upper and lower bands by adding/subtracting ATR × Multiplier from the HL2 (high+low average)
Trailing Logic:
Upper band can ONLY move down or stay flat (never up) during downtrends
Lower band can ONLY move up or stay flat (never down) during uptrends
This prevents premature trend reversals and whipsaws
Trend Determination:
BULLISH when price closes above the upper band
BEARISH when price closes below the lower band
Line colour changes reflect current trend state
WHY IT'S BETTER
Proper Mathematics: Correct band trailing prevents the "flickering" seen in poorly coded versions
Adaptive Volatility: Optional mode adjusts multiplier based on current vs average volatility - tightens in chaos, widens in calm markets
Multiple ATR Methods: Choose between RMA (default), SMA, EMA, or WMA smoothing
Clean Visual Design: Professional presentation with optional dashboard showing real-time metrics
OSCILLATOR MODE - SPOTTING DOUBLE TOPS/BOTTOMS
When used as an oscillator in the lower pane (remove overlay), the Supertrend's trend changes can reveal powerful reversal patterns:
Double Bottoms: When the indicator flips bullish twice at similar price levels, it often signals strong support and potential reversal zones
Double Tops: When the indicator flips bearish twice at similar levels, it identifies resistance and potential breakdown zones
The step-like visualization makes these patterns easier to spot than traditional price action
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.