OPEN-SOURCE SCRIPT
NY Anchored VWAP and Auto SMA

This NY Anchored VWAP and Auto SMA script is a powerful combination of two of the most popular technical indicators, designed to help you identify the intraday trend and potential shifts in market momentum. It stands out by automatically adjusting to current volatility, providing more adaptive and reliable signals than standard moving averages.
How It Works
This script combines a New York session-anchored VWAP with a dynamic Simple Moving Average (SMA) that automatically adjusts its length based on market volatility.
New York Anchored VWAP: The VWAP (Volume-Weighted Average Price) resets at the beginning of the New York trading session. This allows it to accurately track the average price paid by traders for the day, providing a key benchmark for identifying whether the price is trading at a premium or a discount relative to the volume-driven trend. The color of the VWAP line itself changes to indicate its slope: green for an upward trend and red for a downward trend.
Auto SMA: The script calculates a Simple Moving Average (SMA) but with a twist. It uses the Average True Range (ATR) to measure market volatility. When volatility is high, the SMA's lookback period automatically shortens to make it more responsive to price changes. Conversely, when volatility is low, the lookback period lengthens to smooth out the data and reduce noise. This dynamic adjustment helps the SMA stay relevant in all market conditions.
Key Features
Adaptive Lookback: The Auto SMA dynamically adjusts to market volatility, providing more responsive signals during volatile periods and smoother, more reliable signals during calm periods.
Color-Coded VWAP: The VWAP line changes color to instantly show the direction of the trend, making it easy to see at a glance if the average price is rising or falling.
Automated Alerts: The script provides automated alerts for when the VWAP crosses above or below the Auto SMA, signaling potential bullish or bearish momentum shifts.
Customizable Settings: You can hide the VWAP on daily or higher timeframes and change the source for the VWAP calculation to suit your specific trading style.
This tool is perfect for intraday and swing traders who want a more intelligent and adaptive way to measure trend direction and identify potential trading opportunities.
How It Works
This script combines a New York session-anchored VWAP with a dynamic Simple Moving Average (SMA) that automatically adjusts its length based on market volatility.
New York Anchored VWAP: The VWAP (Volume-Weighted Average Price) resets at the beginning of the New York trading session. This allows it to accurately track the average price paid by traders for the day, providing a key benchmark for identifying whether the price is trading at a premium or a discount relative to the volume-driven trend. The color of the VWAP line itself changes to indicate its slope: green for an upward trend and red for a downward trend.
Auto SMA: The script calculates a Simple Moving Average (SMA) but with a twist. It uses the Average True Range (ATR) to measure market volatility. When volatility is high, the SMA's lookback period automatically shortens to make it more responsive to price changes. Conversely, when volatility is low, the lookback period lengthens to smooth out the data and reduce noise. This dynamic adjustment helps the SMA stay relevant in all market conditions.
Key Features
Adaptive Lookback: The Auto SMA dynamically adjusts to market volatility, providing more responsive signals during volatile periods and smoother, more reliable signals during calm periods.
Color-Coded VWAP: The VWAP line changes color to instantly show the direction of the trend, making it easy to see at a glance if the average price is rising or falling.
Automated Alerts: The script provides automated alerts for when the VWAP crosses above or below the Auto SMA, signaling potential bullish or bearish momentum shifts.
Customizable Settings: You can hide the VWAP on daily or higher timeframes and change the source for the VWAP calculation to suit your specific trading style.
This tool is perfect for intraday and swing traders who want a more intelligent and adaptive way to measure trend direction and identify potential trading opportunities.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.