OPEN-SOURCE SCRIPT
Adaptive ATR Trend Bands

Adaptive ATR Trend Bands is a volatility-based trend-state indicator built around a selectable moving average basis and ATR-derived upper/lower bands.
The script creates a dynamic channel around the selected basis type: EMA, SMA, or VWMA. Band width is calculated from ATR length and ATR multiplier settings. The area between the bands changes color according to the current trend state, making it easier to read whether price is operating in bullish or bearish conditions.
Trend shifts are detected when price breaks above the previous upper band from a bearish state or breaks below the previous lower band from a bullish state. When a bullish shift is confirmed, the script can print a LONG label. When a bearish shift is confirmed, the script can print a SHORT label.
Main features:
• ATR-based upper and lower volatility bands;
• Selectable basis type: EMA, SMA, or VWMA;
• Optional basis line with direction-based coloring;
• Trend-state fill between the bands;
• Bullish and bearish trend shift labels;
• Minimum bar distance between repeated labels;
• Optional bar-close confirmation;
• Adaptive basis slope filter;
• Adaptive ATR expansion filter;
• Optional multi-timeframe RSI filter;
• Optional higher-timeframe EMA trend filter;
• Alert conditions for bullish and bearish trend shifts.
The adaptive slope filter checks whether the basis line has enough directional movement relative to current ATR conditions. This helps reduce labels when the basis is too flat and price movement is less directional.
The adaptive ATR expansion filter compares current ATR with its own average for the active chart timeframe. This helps reduce labels during lower-volatility conditions where band breaks may be less meaningful.
The optional multi-timeframe RSI filter uses the previous completed RSI value from the selected higher timeframe. Bullish shifts are allowed when the higher-timeframe RSI is in the lower zone, while bearish shifts are allowed when the higher-timeframe RSI is in the upper zone.
The optional higher-timeframe EMA filter uses the previous completed higher-timeframe close and EMA value. Bullish shifts are allowed when the higher-timeframe close is above the EMA. Bearish shifts are allowed when the higher-timeframe close is below the EMA.
Practical use:
The bands can be used to read volatility-based trend structure. A bullish label marks a confirmed shift from bearish to bullish conditions according to the band break and enabled filters. A bearish label marks a confirmed shift from bullish to bearish conditions according to the band break and enabled filters.
This script is intended for chart analysis and educational use.
The script creates a dynamic channel around the selected basis type: EMA, SMA, or VWMA. Band width is calculated from ATR length and ATR multiplier settings. The area between the bands changes color according to the current trend state, making it easier to read whether price is operating in bullish or bearish conditions.
Trend shifts are detected when price breaks above the previous upper band from a bearish state or breaks below the previous lower band from a bullish state. When a bullish shift is confirmed, the script can print a LONG label. When a bearish shift is confirmed, the script can print a SHORT label.
Main features:
• ATR-based upper and lower volatility bands;
• Selectable basis type: EMA, SMA, or VWMA;
• Optional basis line with direction-based coloring;
• Trend-state fill between the bands;
• Bullish and bearish trend shift labels;
• Minimum bar distance between repeated labels;
• Optional bar-close confirmation;
• Adaptive basis slope filter;
• Adaptive ATR expansion filter;
• Optional multi-timeframe RSI filter;
• Optional higher-timeframe EMA trend filter;
• Alert conditions for bullish and bearish trend shifts.
The adaptive slope filter checks whether the basis line has enough directional movement relative to current ATR conditions. This helps reduce labels when the basis is too flat and price movement is less directional.
The adaptive ATR expansion filter compares current ATR with its own average for the active chart timeframe. This helps reduce labels during lower-volatility conditions where band breaks may be less meaningful.
The optional multi-timeframe RSI filter uses the previous completed RSI value from the selected higher timeframe. Bullish shifts are allowed when the higher-timeframe RSI is in the lower zone, while bearish shifts are allowed when the higher-timeframe RSI is in the upper zone.
The optional higher-timeframe EMA filter uses the previous completed higher-timeframe close and EMA value. Bullish shifts are allowed when the higher-timeframe close is above the EMA. Bearish shifts are allowed when the higher-timeframe close is below the EMA.
Practical use:
The bands can be used to read volatility-based trend structure. A bullish label marks a confirmed shift from bearish to bullish conditions according to the band break and enabled filters. A bearish label marks a confirmed shift from bullish to bearish conditions according to the band break and enabled filters.
This script is intended for chart analysis and educational use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
CT Community from Lithuania: cryptoimperija.com
All content provided by Crypto Imperija is for informational and educational purposes only. Past performance does not guarantee future results.
All content provided by Crypto Imperija is for informational and educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
CT Community from Lithuania: cryptoimperija.com
All content provided by Crypto Imperija is for informational and educational purposes only. Past performance does not guarantee future results.
All content provided by Crypto Imperija is for informational and educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.