OPEN-SOURCE SCRIPT

Adaptive ATR Trend Bands

1 370
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.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。