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.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.