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 sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.