OPEN-SOURCE SCRIPT
Volatility-Driven VWAP Structure (Zeiierman)

█ Overview
Volatility-Driven VWAP Structure (Zeiierman) is a VWAP-based market structure tool that adapts its regime logic using volatility, Z-score normalization, and reversal-anchored VWAP profiles.
The script builds a rolling VWAP structure and adjusts its transition distance using an adaptive volatility engine. The result is a dynamic structure line that shifts only when VWAP displacement is strong enough relative to current volatility conditions.
When a structure reversal occurs, the script resets an anchored VWAP profile from that point and builds deviation bands around it, allowing traders to track the active post-reversal value area.

█ How It Works
⚪ Rolling VWAP Base
The script first calculates a rolling VWAP using price multiplied by volume over the selected lookback period.
Pine Script®
This creates a volume-weighted fair value line that updates continuously without relying on fixed session, daily, weekly, or monthly anchors.
⚪ Adaptive Volatility Engine
The structure step is not fixed. It is based on ATR, a slow ATR comparison, and a Z-score volatility reading.
Pine Script®
This allows the script to identify whether volatility is currently expanding or contracting compared to its recent behavior.
⚪ Sigmoid Volatility Mapping
The volatility ratio and Z-score are blended into a sigmoid function.
Pine Script®
The sigmoid smooths extreme volatility changes, converting them into a controlled, adaptive multiplier.
This helps prevent the structure from becoming too sensitive during noise while still expanding during stronger volatility regimes.
⚪ VWAP Structure Engine
The rolling VWAP is compared against adaptive upper and lower structure levels.
When VWAP expands far enough beyond the current structure range, the script shifts the structure higher or lower.
Pine Script®
If the expansion is strong enough, a new structure direction is assigned:
Pine Script®
This creates bullish and bearish VWAP structure regimes based on volume-weighted displacement, not just candle closes.
⚪ Structure Mean
The main plotted line is the midpoint of the active VWAP structure range.
Pine Script®
This line acts as the active structure mean:
⚪ Reversal-Anchored VWAP Profile
Every time the VWAP structure reverses, a new anchored VWAP profile begins.
Pine Script®
From that reversal point, the script accumulates:
These values are used to calculate the active anchored VWAP and its weighted deviation.
Pine Script®
This creates a fresh value profile after every structural shift.
⚪ Anchored Deviation Bands
The script plots one or two deviation bands around the reversal-anchored VWAP.
Pine Script®
These bands help visualize the active post-reversal value area and potential stretched-price zones.
█ How to Use
⚪ Read the Structure Mean

The structure mean can be used as a dynamic guide for trend bias, continuation, regime changes, and identifying good areas to look for retests on the mean.

⚪ Watch for Structure Reversals
A reversal occurs when the adaptive VWAP structure changes direction.
These reversals reset the anchored VWAP profile, marking the start of a new active value phase.

⚪ Use the Anchored VWAP
After a reversal, the anchored VWAP shows the volume-weighted average price from that new structure point.

⚪ Use the Deviation Bands
The deviation bands show how far the price has moved from the active anchored VWAP.
Touches of the outer bands can be used to identify extended conditions, reaction zones, or continuation pressure.

█ Settings
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Volatility-Driven VWAP Structure (Zeiierman) is a VWAP-based market structure tool that adapts its regime logic using volatility, Z-score normalization, and reversal-anchored VWAP profiles.
The script builds a rolling VWAP structure and adjusts its transition distance using an adaptive volatility engine. The result is a dynamic structure line that shifts only when VWAP displacement is strong enough relative to current volatility conditions.
When a structure reversal occurs, the script resets an anchored VWAP profile from that point and builds deviation bands around it, allowing traders to track the active post-reversal value area.
█ How It Works
⚪ Rolling VWAP Base
The script first calculates a rolling VWAP using price multiplied by volume over the selected lookback period.
float rollingVwap = math.sum(src * volume, vwapLengthInput) / math.sum(volume, vwapLengthInput)
This creates a volume-weighted fair value line that updates continuously without relying on fixed session, daily, weekly, or monthly anchors.
⚪ Adaptive Volatility Engine
The structure step is not fixed. It is based on ATR, a slow ATR comparison, and a Z-score volatility reading.
float atrZ = atrDev != 0 ? (atrFast - atrMean) / atrDev : 0.0
float volRatio = atrSlow != 0 ? atrFast / atrSlow : 1.0
This allows the script to identify whether volatility is currently expanding or contracting compared to its recent behavior.
⚪ Sigmoid Volatility Mapping
The volatility ratio and Z-score are blended into a sigmoid function.
float sigmoidInput = 4.0 * (volRatio - 1.0) + 0.75 * atrZClamped
float sigmoid = 1.0 / (1.0 + math.exp(-sigmoidInput))
The sigmoid smooths extreme volatility changes, converting them into a controlled, adaptive multiplier.
This helps prevent the structure from becoming too sensitive during noise while still expanding during stronger volatility regimes.
⚪ VWAP Structure Engine
The rolling VWAP is compared against adaptive upper and lower structure levels.
When VWAP expands far enough beyond the current structure range, the script shifts the structure higher or lower.
float upsideExpansion = rollingVwap - (structureUpper + structureStep)
float downsideExpansion = (structureLower - structureStep) - rollingVwap
If the expansion is strong enough, a new structure direction is assigned:
int nextDirection = expandsHigher ? 1 : expandsLower ? -1 : direction
This creates bullish and bearish VWAP structure regimes based on volume-weighted displacement, not just candle closes.
⚪ Structure Mean
The main plotted line is the midpoint of the active VWAP structure range.
float structureMid = (structureUpper + structureLower) / 2.0
This line acts as the active structure mean:
- When the regime is bullish, it uses the bullish color.
- When the regime is bearish, it uses the bearish color.
⚪ Reversal-Anchored VWAP Profile
Every time the VWAP structure reverses, a new anchored VWAP profile begins.
bool anchorReset = isReversed or na(anchorSumPV)
From that reversal point, the script accumulates:
- price × volume
- volume
- price² × volume
These values are used to calculate the active anchored VWAP and its weighted deviation.
float anchoredVwap = anchorSumV != 0 ? anchorSumPV / anchorSumV : na
float anchoredDev = not na(anchoredVar) ? math.sqrt(math.max(anchoredVar, 0)) : na
This creates a fresh value profile after every structural shift.
⚪ Anchored Deviation Bands
The script plots one or two deviation bands around the reversal-anchored VWAP.
float anchorUpper1 = anchoredVwap + anchoredDev * bandMult1
float anchorLower1 = anchoredVwap - anchoredDev * bandMult1
These bands help visualize the active post-reversal value area and potential stretched-price zones.
█ How to Use
⚪ Read the Structure Mean
- Bullish color → VWAP structure is in an upward regime
- Bearish color → VWAP structure is in a downward regime
The structure mean can be used as a dynamic guide for trend bias, continuation, regime changes, and identifying good areas to look for retests on the mean.
⚪ Watch for Structure Reversals
A reversal occurs when the adaptive VWAP structure changes direction.
These reversals reset the anchored VWAP profile, marking the start of a new active value phase.
⚪ Use the Anchored VWAP
After a reversal, the anchored VWAP shows the volume-weighted average price from that new structure point.
- Price above anchored VWAP → stronger bullish control
- Price below anchored VWAP → stronger bearish control
⚪ Use the Deviation Bands
The deviation bands show how far the price has moved from the active anchored VWAP.
- Band 1 → normal value expansion
- Band 2 → stronger price extension
Touches of the outer bands can be used to identify extended conditions, reaction zones, or continuation pressure.
█ Settings
- Rolling VWAP Length: Controls the lookback period for the rolling VWAP calculation.
- Structure Multiplier: Controls how wide the adaptive structure transitions are.
- Volatility Length: Controls the ATR length used in the volatility engine.
- Band 1 Multiplier: Controls the first anchored VWAP deviation band.
- Band 2 Multiplier: Controls the second anchored VWAP deviation band.
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Access my indicators at: zeiierman.com
Join Our Free Discord: discord.gg/zeiiermantrading
Join Our Free Discord: discord.gg/zeiiermantrading
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Access my indicators at: zeiierman.com
Join Our Free Discord: discord.gg/zeiiermantrading
Join Our Free Discord: discord.gg/zeiiermantrading
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.