Structure-Anchored VWAP

1 225
Structure-Anchored VWAP — a VWAP that re-anchors to market structure, not the clock

A normal VWAP resets on a fixed session — the day, the week. But the level that matters is rarely the one measured from midnight; it's the one measured from the move you're actually trading: the last change of character, the last break of structure, the last liquidity sweep. Structure-Anchored VWAP resets its cumulative volume-weighted average price from the structural event YOU choose, so the mean / value line is always measured from what is driving price right now.

It's a value / mean-reference tool — a place to read where "fair value" sits for the current leg and how stretched price is from it. Free and open-source. Please read the honest note below — it makes no win-rate or profit claims.

── WHAT IT DOES ──────────────────────────────────────────

1) STRUCTURE-CHOSEN ANCHOR
Pick the event that resets the VWAP (clears its cumulative price×volume sums and starts fresh from that bar):
• Last CHoCH — the first break AGAINST the prevailing trend (change of character).
• Last BOS — a break of structure in the trend direction (continuation).
• Last liquidity sweep — a wick past the latest swing high/low that closes back inside (a stop-hunt).
• Session start — the beginning of each session on a timeframe you set (D / W / …).
• Any structure shift — whichever of BOS / CHoCH / sweep prints first.
Every structural event is confirmed on bar close — it does not repaint.

2) MANUAL CUMULATIVE VWAP
The line is a true anchored VWAP built by hand — Σ(price×volume) / Σ(volume) accumulated from the anchor bar forward — not the fixed session VWAP. Source is selectable (hlc3 default, or close / ohlc4 / hl2). On symbols with no volume, it falls back to an equal-weight average so the line still means something.

3) DEVIATION BANDS (±1σ / ±2σ)
Inner and outer bands drawn from the volume-weighted standard deviation of price around the anchored VWAP (classic VWAP bands), shown as a shaded envelope. Bands are naturally tight right after an anchor and widen as the leg develops. Both multipliers are adjustable.

4) ANCHOR MARKERS
A small ⚓ marker drops on every re-anchor, naming the event (BOS ▲/▼, CHoCH ▲/▼, Sweep ▲/▼, Session), so you can see exactly where and why the VWAP reset.

── HOW TO USE IT ─────────────────────────────────────────
• Value reference: the anchored VWAP is a running "fair value" for the current leg. Price trading back to it after an extension is a mean-reference event — where responsive participants often reappear.
• Bands as context: the outer band flags a statistically stretched excursion from the leg's mean. That's context for a decision, not a signal to fade — strong trends can ride an outer band.
• Anchor choice matters: a CHoCH anchor frames value from the last shift in character; a sweep anchor frames it from the last stop-hunt; a session anchor gives a classic session value line. Match the anchor to the question you're asking.

── NON-REPAINTING ────────────────────────────────────────
By the nature of a VWAP, the line and its bands UPDATE LIVE on the developing (unclosed) bar — that is expected and correct; a VWAP is a running average that finalises when the bar closes. The ANCHOR events that reset it are confirmed on bar close (barstate.isconfirmed) using closed-bar swing pivots, so they do not repaint — an anchor doesn't appear and then move once set.

Free & open-source (MPL-2.0). For research and education. Not financial advice; no guarantee of profit. Test on your own markets and manage your own risk.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.