Anchored VWAP Pullback & Target Zones [PhenLabs]

🎯 Overview
Anchored VWAP Pullback & Target Zones [PhenLabs] is an institutional trend-pullback and trade-execution engine built on Pine Script v6. It solves the three biggest problems traders face when trading Anchored VWAP (AVWAP) on intraday and swing charts:
Whether you trade index futures (NQ, ES, MNQ), FX majors, Gold (XAUUSD), crypto perps, or liquid equities, Anchored VWAP Pullback & Target Zones [PhenLabs] turns raw volume-weighted value bands into an objective, self-auditing pullback playbook.
🧠 How It Works — 4-Stage Non-Repainting State Machine
Every signal and trade plan is governed by a deterministic 4-stage state machine (`IDLE -> IMPULSE_ANCHORED -> PULLBACK_IN_ZONE -> RECLAIM_CONFIRMED`):
⚙️ Under the Hood — Mathematical Formulation
1. Cross-Asset Activity Weight & Anchored Moments
To guarantee identical mathematical rigor on Tick/Volume futures, Spot Crypto, and CFD/Forex pairs where volume may be sparse, each bar since the anchor index t0 is weighted by volume (or normalized true-range activity w_i = TR_i / ATR_14 when volume is unavailable):
Pine Script®
During the initial bars immediately following a fresh anchor reset, σ blends smoothly with local ATR so the value zone never collapses to zero width on bar 1 of a new impulse.
2. Anchor-Leg Kaufman Efficiency Ratio (Chop Suppression)
Let P_0 be the anchor origin price and P_t be the current close. The cumulative path length along the anchor leg is the sum of absolute bar-to-bar close changes since the anchor bar. Trend efficiency is defined as:
Pine Script®
High ER_pct values indicate clean institutional directional imbalance; low ER_pct values diagnose overlapping mean-reverting chop.
3. Independent 7-Profile Tournament Ledger (Auto-Optimization)
Instead of evaluating only the currently displayed preset, the script runs 7 independent UDT state-machine ledgers in parallel on every bar:
When Pullback Filter Profile is set to `Auto-Optimize (Best Chart Win Rate)`, the engine continuously ranks Profiles 0–5 by shrunk empirical win rate and cumulative realized R-multiples on the active chart and timeframe, automatically binding your chart visuals and alerts to the strongest-performing profile.
📊 Visual Walkthrough & Telemetry Dashboard
🛠️ Input Guide (14 Streamlined Controls Across 4 Groups)
Group 1 — Structural Anchor & AVWAP Value Band
Group 2 — Pullback Chop Filter & Auto-Optimizer
Group 3 — Entry, Stop Loss & TP1–TP3 Targets
Group 4 — Visuals & Dashboard
🚀 Built-In Alerts
Includes a unified alert() dispatcher (delivering symbol, timeframe, entry, stop loss, TP1–TP3, quality score, and active profile win rate) plus 6 granular alertcondition() triggers:
⚠️ Risk Disclaimer
This indicator is an analytical decision-support tool designed for educational and informational purposes only. Historical profile win rates and cumulative R-multiples are computed from closed-bar state-machine simulations on your active chart history and do not guarantee future performance. Always validate setups within your own risk management framework.
Anchored VWAP Pullback & Target Zones [PhenLabs] is an institutional trend-pullback and trade-execution engine built on Pine Script v6. It solves the three biggest problems traders face when trading Anchored VWAP (AVWAP) on intraday and swing charts:
- Manual Re-Anchoring Fatigue: Traditional AVWAP tools require you to manually click new swing highs and lows after every structural break. This engine automatically detects confirmed Break of Structure (BOS) impulses and re-anchors a dual-moment volume/activity-weighted VWAP directly to the impulse origin pivot—where institutional accumulation or distribution actually started.
- Sideways Chop Bleed Around Flat VWAP: Most VWAP pullback scripts fire signals whenever price touches a band, bleeding R-multiples when the anchor leg flattens into sideways consolidation. Before any pullback can arm, the engine requires the active impulse leg to pass a Kaufman Efficiency Ratio (ER) trend-efficiency gate and directional slope check, suppressing low-efficiency chop and marking rejected touches with optional `SKIP` audit diamonds.
- Guessing Stops & Exit Targets: Touching an AVWAP band is not an execution plan. Once price pulls back into the ±kσ institutional value zone and closes back across the band in trend direction, the indicator draws a complete, non-repainting trade plan with an Entry line, Stop Loss zone (auto-ratcheting to Break-Even after TP1), and TP1 / TP2 / TP3 target ladder anchored to the impulse swing high/low liquidity magnet and exact R-multiples.
Whether you trade index futures (NQ, ES, MNQ), FX majors, Gold (XAUUSD), crypto perps, or liquid equities, Anchored VWAP Pullback & Target Zones [PhenLabs] turns raw volume-weighted value bands into an objective, self-auditing pullback playbook.
🧠 How It Works — 4-Stage Non-Repainting State Machine
Every signal and trade plan is governed by a deterministic 4-stage state machine (`IDLE -> IMPULSE_ANCHORED -> PULLBACK_IN_ZONE -> RECLAIM_CONFIRMED`):
- Stage 1 — Structural Impulse & Auto-Anchor (`IMPULSE_ANCHORED`):
The engine tracks confirmed swing highs and swing lows over your chosen Structural Swing Pivot Length. When a candle closes beyond the active swing high with body expansion (Bullish BOS) or below the active swing low (Bearish BOS), the engine automatically anchors a fresh AVWAP to the exact bar and price of the originating opposite pivot (the lowest low before a bullish breakout or highest high before a bearish breakdown). You can also switch the anchor mode to Higher-Timeframe / Daily Session Open or Rolling Institutional Window. - Stage 2 — Value-Zone Pullback Detection (`PULLBACK_IN_ZONE`):
As the anchored impulse develops, the engine computes the continuous volume-weighted mean (AVWAP) and standard deviation dispersion (σ), plotting the core AVWAP spine, the inner ±kσ Pullback Value Band, and the outer ±mσ Exhaustion Envelope. When price pulls back into the active value band (testing between AVWAP + kσ and AVWAP - mσ in a bullish regime, or the mirrored zone in a bearish regime), the engine arms the pullback tracker and records the deepest pullback excursion without firing premature intrabar alerts. - Stage 3 — Chop Filter & Reclaim Confirmation (`RECLAIM_CONFIRMED`):
When a candle closes back out of the value band in the direction of the impulse with positive candle-body conviction, the engine evaluates its multi-factor quality gate:
• Directional Trend Efficiency (ER): Verifies that net displacement from the anchor pivot divided by cumulative path length exceeds the profile’s minimum efficiency threshold, filtering out whipsaw ranges.
• AVWAP Slope Alignment: Confirms the anchored VWAP spine is actively sloping in the trade direction or holding structural displacement.
• Composite Pullback Quality Score (0–100%): Combines trend efficiency (40% weight), candle-body reclaim conviction (35% weight), and relative volume/range participation (25% weight).
• Transparent Audit: Setups that pass all gates trigger a confirmed `AVPT LONG` or `AVPT SHORT` trade plan. Setups that fail the efficiency, quality, or participation gate are suppressed and optionally marked with a `SKIP` diamond showing the exact rejection reason (e.g., `SKIP 19%EFF`). - Stage 4 — Full Trade Plan & Auto Break-Even Ratchet:
Upon confirmation, the indicator locks in the Entry at the reclaim close, places the initial Stop Loss beyond the deepest pullback wick or outer σ band (buffered by ATR and enforced against a minimum ATR floor), and projects TP1, TP2, and TP3. When TP1 is reached, the active stop automatically ratchets to the entry price (Break-Even) to protect capital while tracking runner progression to TP2 and TP3.
⚙️ Under the Hood — Mathematical Formulation
1. Cross-Asset Activity Weight & Anchored Moments
To guarantee identical mathematical rigor on Tick/Volume futures, Spot Crypto, and CFD/Forex pairs where volume may be sparse, each bar since the anchor index t0 is weighted by volume (or normalized true-range activity w_i = TR_i / ATR_14 when volume is unavailable):
During the initial bars immediately following a fresh anchor reset, σ blends smoothly with local ATR so the value zone never collapses to zero width on bar 1 of a new impulse.
2. Anchor-Leg Kaufman Efficiency Ratio (Chop Suppression)
Let P_0 be the anchor origin price and P_t be the current close. The cumulative path length along the anchor leg is the sum of absolute bar-to-bar close changes since the anchor bar. Trend efficiency is defined as:
High ER_pct values indicate clean institutional directional imbalance; low ER_pct values diagnose overlapping mean-reverting chop.
3. Independent 7-Profile Tournament Ledger (Auto-Optimization)
Instead of evaluating only the currently displayed preset, the script runs 7 independent UDT state-machine ledgers in parallel on every bar:
- Profile 0 — Balanced: 1.0σ value band · 26% min efficiency · 52% min quality score
- Profile 1 — Conservative: 0.8σ value band · 35% min efficiency · 64% min quality score
- Profile 2 — Aggressive: 1.25σ value band · 18% min efficiency · 42% min quality score
- Profile 3 — Shallow Pullback: 0.65σ tight institutional band · 30% min efficiency · 58% min quality
- Profile 4 — Deep Value Reclaim: 1.45σ deep discount/premium band · 22% min efficiency · 50% min quality
- Profile 5 — Volume Climax: 1.0σ band + 1.25x relative volume/activity surge requirement
- Profile 6 — Custom Thresholds: Driven directly by your custom σ multiplier and minimum efficiency inputs
When Pullback Filter Profile is set to `Auto-Optimize (Best Chart Win Rate)`, the engine continuously ranks Profiles 0–5 by shrunk empirical win rate and cumulative realized R-multiples on the active chart and timeframe, automatically binding your chart visuals and alerts to the strongest-performing profile.
📊 Visual Walkthrough & Telemetry Dashboard
- Core AVWAP Spine & Value Zone Cloud: The central anchored VWAP line shifts color with structural bias (Teal in Bullish Impulse, Coral Red in Bearish Impulse, Slate in Neutral/Range) and is surrounded by a shaded ±kσ value cloud and dotted outer exhaustion envelope.
- Anchor Origin Badge: Marks the exact pivot bar and price where the current structural impulse originated (`⚓ BULL AVWAP` or `⚓ BEAR AVWAP`).
- Pullback Zone & Trade Plan Projections: Displays the shaded pullback test window alongside crisp horizontal `ENTRY`, `SL` (or `SL (BE)`), `TP1`, `TP2`, and `TP3` levels with exact prices, R-multiples, and `MAG` badges when a target snaps to the prior impulse high/low liquidity pool.
- 9-Row Glassmorphic Telemetry Table: Displays real-time Anchor Bias & Origin, AVWAP Price & ±1σ Dispersion, Trend Efficiency & Active Value Band, Active Filter Profile (Auto vs. Manual), Resolved Win Rate (with TP1 / TP2 / TP3 hit breakdown), Cumulative Net R & Average R/Trade, Active Trade Plan status, Last Reclaim Quality Score, and Next Action guidance.
🛠️ Input Guide (14 Streamlined Controls Across 4 Groups)
Group 1 — Structural Anchor & AVWAP Value Band
- Anchor Origin Mode: Choose `Auto Structural Impulse (BOS Pivot)` (default), `Higher-Timeframe / Session Open`, or `Rolling Institutional Window`.
- Structural Swing Pivot Length: Lookback/lookforward bars used to confirm structural swing highs and lows (default `5`).
- HTF Anchor Timeframe: Timeframe used when Session/HTF Anchor Mode is selected (default `1D`).
- Custom Value Zone Width (σ Multiplier): Inner value-band standard deviation multiplier used by the `Custom Thresholds` profile (default `1.0`).
Group 2 — Pullback Chop Filter & Auto-Optimizer
- Pullback Filter Profile: Default `Auto-Optimize (Best Chart Win Rate)`, or lock manually to Balanced, Conservative, Aggressive, Shallow Pullback, Deep Value Reclaim, Volume Climax, or Custom Thresholds.
- Custom Min Trend Efficiency (0–100%): Minimum Kaufman Efficiency Ratio along the anchor leg when using Custom Thresholds (default `26.0%`).
- Plot Suppressed Chop Touches (SKIP): Toggles subtle `SKIP` diamonds and rejection tags on low-efficiency or weak-body band touches.
Group 3 — Entry, Stop Loss & TP1–TP3 Targets
- Target Projection Mode: Choose `R Ladder + Impulse High/Low Magnet` (snaps TP1 or TP2 to the impulse swing extreme when it aligns within realistic R bounds) or `Fixed R Ladder (1R / 2R / 3R)`.
- Stop Loss ATR Buffer (x ATR): ATR cushion added beyond the pullback wick / outer σ band (default `0.25`).
- TP1 / TP2 / TP3 R-Multiples: Customize your three target R-multiples (defaults: `1.0R`, `2.0R`, `3.0R`).
Group 4 — Visuals & Dashboard
- Historical Trade Plans to Display: Number of completed + active trade plans rendered on the chart (1 to 20, default `5`).
- Dashboard Position & Size: Place the telemetry table in any chart corner (Top Right, Bottom Right, Top Left, Bottom Left, or Hidden) with Small, Normal, or Large typography.
🚀 Built-In Alerts
Includes a unified alert() dispatcher (delivering symbol, timeframe, entry, stop loss, TP1–TP3, quality score, and active profile win rate) plus 6 granular alertcondition() triggers:
- `AVPT: Bullish Pullback Reclaim (LONG)`
- `AVPT: Bearish Pullback Reclaim (SHORT)`
- `AVPT: Any Pullback Trade Plan (LONG/SHORT)`
- `AVPT: New Structural AVWAP Anchor Shift`
- `AVPT: Target Hit (TP1 / TP2 / TP3)`
- `AVPT: Stop Loss / Break-Even Exit`
⚠️ Risk Disclaimer
This indicator is an analytical decision-support tool designed for educational and informational purposes only. Historical profile win rates and cumulative R-multiples are computed from closed-bar state-machine simulations on your active chart history and do not guarantee future performance. Always validate setups within your own risk management framework.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน