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
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.