OPEN-SOURCE SCRIPT
Volume Weighted ATR

This script implements a Volume‑Weighted Average True Range (VWATR) indicator, a variation of ATR that incorporates trading volume into the volatility calculation. Instead of treating all price movements equally, it amplifies true range during high‑volume periods and dampens it during low‑volume periods, producing a volatility measure that adapts to liquidity conditions. The script begins by allowing the user to choose a lookback length and a smoothing method, offering RMA, SMA, EMA, or WMA for flexibility in how responsive the indicator should be.
The core of the calculation starts with the standard true range, which captures the most meaningful price movement of each bar. This true range is then multiplied by volume, creating a volume‑weighted true range that gives more importance to bars where market participation is higher. To ensure consistency, the script defines a custom moving‑average function that applies the selected smoothing method to any input series. This function is used twice: once to smooth the volume‑weighted true range and once to smooth volume itself.
The final VWATR value is obtained by dividing the smoothed volume‑weighted true range by the smoothed volume. Mathematically, this produces a volume‑weighted mean of true range, making the indicator more sensitive to volatility expansions that occur with strong participation and less reactive to low‑volume noise. The script concludes by plotting this VWATR line, giving traders a clean, adaptive measure of volatility that can be used for regime detection, breakout confirmation, or dynamic stop sizing
The core of the calculation starts with the standard true range, which captures the most meaningful price movement of each bar. This true range is then multiplied by volume, creating a volume‑weighted true range that gives more importance to bars where market participation is higher. To ensure consistency, the script defines a custom moving‑average function that applies the selected smoothing method to any input series. This function is used twice: once to smooth the volume‑weighted true range and once to smooth volume itself.
The final VWATR value is obtained by dividing the smoothed volume‑weighted true range by the smoothed volume. Mathematically, this produces a volume‑weighted mean of true range, making the indicator more sensitive to volatility expansions that occur with strong participation and less reactive to low‑volume noise. The script concludes by plotting this VWATR line, giving traders a clean, adaptive measure of volatility that can be used for regime detection, breakout confirmation, or dynamic stop sizing
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.