OPEN-SOURCE SCRIPT

Auto Anchored Swing VWAP's

The Auto Anchored Swing VWAP's indicator automatically anchors Volume-Weighted Average Price (VWAP) lines to recent swing highs and swing lows. VWAPs often act as key support or resistance levels because they represent the average price at which the majority of trading volume has occurred over a given time.

What is VWAP? VWAP is an essential tool in trading, representing the average price of a security over a specific period, weighted by volume. It helps traders identify the average price at which most trades have been executed, providing a balanced view of price action over time.

Anchored VWAPs: Unlike traditional VWAPs, which start from the beginning of the day, anchored VWAPs allow traders to "anchor" the calculation to a specific point in time or a pivot on the chart, in this case a swing high and swing low. This version of VWAP follows the price action from a selected point forward.

When the price is above the VWAP, it indicates that the majority of traders have paid less for the asset, creating a potential support zone as buyers may step in at or near this level. On the other hand, when the price is below the VWAP, it suggests that most traders have paid a higher price, which can lead to a resistance level where sellers may appear to defend their positions.

Anchored VWAPs, in particular, provide more precise support and resistance levels by starting from a specific swing high, swing low, or other significant point on the chart. This allows traders to track how price interacts with these levels after a certain bar.

The selectable pivot lookback length in this indicator defines the number of bars to the left and right of a potential swing high or swing low that must be lower (for a swing high) or higher (for a swing low) in order to confirm the pivot. In other words, it controls how many surrounding bars need to validate a local price extreme before it is considered a true swing point.

For example, if the lookback length is set to 9, a swing high is identified when there are 9 bars to the left and 9 bars to the right that all have lower highs than the current bar. The same logic applies for swing lows, where the price must be lower than the highs of the bars to the left and right for it to be considered a swing low.

This parameter allows traders to control the sensitivity of the swing points used to anchor VWAPs. A smaller lookback value will identify more frequent and short-term swing highs and lows, making the VWAPs more responsive to recent price action. Conversely, a larger lookback value will result in fewer but more significant swing points.

Pine Script
Utilization of Pine Script’s Enum Feature: This indicator leverages Pine Script's new enum feature for the selection of the VWAP lines (solid, dashed, or dotted) style.

Moving AveragesVolumeVolume Weighted Average Price (VWAP)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Trusted Pine programmer. Send me a message for script development.
Also on:

Disclaimer