OPEN-SOURCE SCRIPT

Periodic Anchored VWAP

1 927
Periodic Anchored VWAP

Overview
The Periodic Anchored VWAP is a professional volume-weighted average price indicator that anchors VWAP calculations to fixed calendar periods. Unlike traditional anchored VWAP tools that require manual point-and-click anchoring, this indicator automatically resets VWAP calculations at predefined interval boundaries (hourly, daily, weekly, monthly), providing a clean, systematic approach to volume-weighted support and resistance analysis.

Key Features
  1. 13 Anchor Periods: 1H, 4H, 6H, 12H, 1D, 3D, 1W, 2W, 1M, 2M, 3M, 6M, 12M
  2. Smart Timeframe Filtering: Automatically hides VWAPs when chart timeframe equals or exceeds anchor period
  3. Individual Period Controls: Toggle each VWAP on/off independently with custom colors
  4. Master Toggle: Global show/hide for all VWAP lines
  5. Dynamic Labels: Real-time price labels at the right edge of chart
  6. Compact Settings: Streamlined input panel with inline color pickers


How It Works
The Golden Rule
VWAP is displayed ONLY when: Chart Timeframe < Anchor Period
This ensures VWAP lines always represent meaningful continuous calculations. For example:
  • 1H VWAP appears only on timeframes smaller than 1 hour (e.g., 15min, 5min, 1min)
  • 1D VWAP appears only on timeframes smaller than daily (e.g., 4H, 1H, 15min)
  • 1W VWAP appears only on timeframes smaller than weekly (e.g., daily, 4H, 1H)


Anchor Logic
Each VWAP resets at its respective period boundary:
  • Intraday Anchors (1H, 4H, 6H, 12H): Reset at the start of each hour/4-hour/6-hour/12-hour period
  • Daily Anchors (1D, 3D): Reset at daily market open
  • Weekly Anchors (1W, 2W): Reset at weekly market open
  • Monthly Anchors (1M, 2M, 3M, 6M, 12M): Reset at month boundaries


Input Settings
Master Control:
VWAP Display Show / Hide Global toggle for all VWAP lines

Intraday Anchors (Default: Off):
  • 1H => Teal => Short-term intraday reference
  • 4H => Pink => Medium-term intraday reference
  • 6H => Magenta => Half-day session reference
  • 12H => Cyan => Full session reference


Anchor VWAP Periods (Default: On):
  • 1D => Yellow/Green => Daily support/resistance
  • 3D => Purple => Multi-day trend reference
  • 1W => Blue => Weekly pivot levels
  • 2W => Light Blue => Bi-weekly trend
  • 1M => Green => Monthly support/resistance
  • 2M => Dark Green => 2-month horizon
  • 3M => Yellow => Quarterly reference
  • 6M => Orange => Semi-annual trend
  • 12M => Red => Annual benchmark


Visual Display
  • VWAP Lines: Colored lines plotted at 2px thickness for clear visibility:
  • Right-Edge Labels: Compact labels showing period and current VWAP value
  • Smart Label Colors: Black or white text automatically based on line color for optimal readability


Use Cases
Intraday Trading:
  • Use 1H, 4H, 6H, 12H VWAPs on lower timeframes (e.g., 5min, 15min) to identify intraday support/resistance levels
  • Multiple intraday VWAPs reveal stacked liquidity zones


Swing Trading:
  • 1D, 3D, 1W, 2W VWAPs help identify trend direction and mean reversion levels
  • Weekly VWAP provides context for daily price action


Position Trading:
  • 1M, 3M, 6M, 12M VWAPs offer long-term benchmarks for valuation assessment
  • Multiple monthly VWAPs show multi-year price distribution


Multi-Timeframe Analysis:
  • Visualize up to 13 VWAP levels simultaneously
  • Identify confluences where multiple VWAP periods align
  • Observe how price interacts with different anchored levels



Important Notes
  1. Timeframe Limitations: VWAPs automatically hide when the chart timeframe is equal to or greater than the anchor period (prevents misleading point-to-point lines)
  2. Intraday Anchors Disabled by Default: Enable only the periods relevant to your trading style to reduce visual clutter
  3. Monthly Anchors: Use 30-day approximation for minute calculations; display logic ensures they only appear on daily or lower timeframes
  4. Label Positioning: Labels appear 1-13 bars to the right of the current bar to prevent overlap with price action


Performance
  • Efficiently coded with looped label management
  • No repainting — all calculations are historical
  • Compatible with all markets and symbols


Version History
  • v.1.0 => Initial release with 13 anchor periods, timeframe validation, and dynamic labels


Start using Periodic Anchored VWAP to elevate your volume-weighted analysis across all timeframes!


Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.