Anchored VWAP
Oct 25, 2017

The Anchored VWAP indicator provides a volume-weighted average price starting from a specific, user-defined point in time, allowing traders to evaluate the market's value relative to a significant event or price level.
Usage
The Usage of the Anchored VWAP is centered around identifying the average price paid for an asset since a specific anchor point, such as a swing high, swing low, or economic announcement. Traders typically use this to identify dynamic support and resistance levels. When the price is above the Anchored VWAP, the market is generally considered to be in a bullish state relative to the anchor; when below, it is considered bearish.
Example use cases:
- Trend Confirmation: Use the slope and position of the VWAP line to confirm the prevailing trend starting from a specific date.
- Mean Reversion: Identify potential "pullbacks" to the VWAP line as entry opportunities in a trending market.
- Support/Resistance: Observe how price reacts when it touches the line to gauge institutional interest at that level.
Details
This script calculates the Volume Weighted Average Price (VWAP) by accumulating the product of price (OHLC4) and volume, then dividing it by the accumulated volume. Unlike standard VWAPs that reset daily, weekly, or monthly, this version "anchors" the calculation to a specific timestamp provided in the settings. The calculation begins precisely when the chart time matches the user-defined year, month, day, hour, and minute.
This implementation includes built-in alert conditions for price crossovers, enabling automated notifications when market sentiment shifts relative to the chosen anchor. It was built upon concepts shared by drshoe.
Settings
- Year: Sets the starting year for the VWAP calculation anchor.
- Month: Sets the starting month for the VWAP calculation anchor.
- Day: Sets the starting day for the VWAP calculation anchor.
- Hour: Sets the starting hour (24-hour format) for the VWAP calculation anchor.
- Minute: Sets the starting minute for the VWAP calculation anchor.
- Debug Mode: When enabled, displays internal time data (hour and minute) in the Data Window to assist in verifying anchor placement.
FAQ
How do I access the Anchored VWAP?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can this be used on intraday timeframes?
Yes, the script is designed to function on any timeframe, including intraday charts, provided the anchor date is within the available historical data.
Why is the line not appearing on my chart?
Ensure that the "Year, Month, Day" settings are set to a date that exists on your current chart's history. If the anchor date is in the future or too far in the past for the current timeframe's data, the line will not render.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.