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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.