ZWAP (ZigZag Anchored VWAP)
Sep 29, 2023

The ZWAP (ZigZag Anchored VWAP) indicator automatically anchors Volume Weighted Average Price (VWAP) calculations to significant ZigZag pivot points to identify dynamic support and resistance levels. By utilizing high-performance polyline rendering, it can display up to 100 historical VWAPs simultaneously, providing a comprehensive view of institutional volume-weighted value across multiple market swings.
Usage
The tool is designed to highlight where price stands relative to historical volume nodes. It can be used in several ways:
- Trend Reversals: When price crosses an anchored VWAP from a previous swing high or low, it often indicates a shift in market sentiment.
- Dynamic Support/Resistance: VWAP lines anchored to pivots act as key areas where buyers or sellers have historically committed capital.
- Visible Range Analysis: Users can toggle the tool to calculate and anchor VWAPs based only on the data visible on the current chart view.
- Curved ZigZag: The indicator includes an aesthetic "Curvy Zig Zag" feature to visualize price movement between anchors without cluttering the chart with rigid lines.
Details
Traditional auto-anchored VWAPs in Pine Script are often limited by the 500-line buffer when using standard drawing functions. This script overcomes those limitations by using the polyline function, which treats a multi-coordinate path as a single object. This allows the indicator to track 10,000 coordinate points per line and maintain up to 100 concurrent VWAP streams. Every time a new ZigZag pivot is confirmed, the script initiates a new calculation loop, summing the price-volume product from the anchor point to the current bar.
Settings
- Use Visible Range: When enabled, the indicator only calculates anchors for the price action currently visible on your screen.
- Curvy Zig Zag: Toggles a smoothed visual representation of the underlying ZigZag trend.
- Pivots To Show: Defines the maximum number of historical anchored VWAPs to display on the chart (up to 100).
- Start Time: Sets the historical point from which the indicator begins searching for anchors (if not using Visible Range).
- Color As Support / Resistance: Automatically changes the VWAP line color based on whether the current price is above (support) or below (resistance) the line.
- Zig Zag Settings:
- Price deviation for reversals (%): The percentage price must move to confirm a new ZigZag leg.
- Pivot legs: The number of bars required to confirm a high or low pivot.
FAQ
How do I access ZWAP (ZigZag Anchored VWAP)?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Why do some VWAP lines disappear?
The indicator is limited to showing a maximum of 100 anchors at once to maintain chart performance. If you have "Pivots To Show" set to a lower number, older anchors will be removed as new ones form.
Does this indicator repaint?
The ZigZag anchors rely on pivot confirmation, which requires a specific number of "Pivot legs" to pass before a point is locked. While the VWAP calculation itself updates in real-time, the anchor point is determined once the ZigZag confirms a reversal.
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.