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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。