OPEN-SOURCE SCRIPT
VWAP Composites

๐ VWAP Composite - Advanced Multi-Period Volume Weighted Average Price Indicator
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ OVERVIEW
VWAP Composite is an advanced volume-weighted average price (VWAP) indicator that goes beyond traditional single-period VWAP calculations by offering composite multi-period analysis and unprecedented customization. This indicator solves a common problem traders face: traditional VWAP resets at arbitrary intervals (session start, day, week), but significant price action and volume accumulation often spans multiple periods. VWAP Composite allows you to anchor VWAP calculations to any timeframeโor combine multiple periods into a single composite VWAPโgiving you a true representation of average price weighted by volume across the exact periods that matter to your analysis.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ HOW IT WORKS - CALCULATION METHODOLOGY
๐ CORE VWAP CALCULATION
The indicator calculates VWAP using the standard volume-weighted formula:
โข Typical Price = (High + Low + Close) / 3
โข VWAP = ฮฃ(Typical Price ร Volume) / ฮฃ(Volume)
This calculation is performed across user-defined time periods, ensuring each bar's contribution to the average is proportional to its trading volume.
๐ STANDARD DEVIATION BANDS
The indicator calculates volume-weighted standard deviation to measure price dispersion around the VWAP:
โข Variance = ฮฃ[(Typical Price - VWAP)ยฒ ร Volume] / ฮฃ(Volume)
โข Standard Deviation = โVariance
โข Upper Band = VWAP + (StdDev ร Multiplier)
โข Lower Band = VWAP - (StdDev ร Multiplier)
These bands help identify overbought/oversold conditions relative to the volume-weighted mean, with high-volume price excursions having greater impact on band width than low-volume moves.
๐ COMPOSITE PERIOD METHODOLOGY (Auto Mode)
Unlike traditional VWAP that resets at fixed intervals, Auto Mode creates composite VWAPs by combining the current period with N previous periods:
โข Period Span = 1: Current period only (standard VWAP behavior)
โข Period Span = 2: Current period + 1 previous period combined
โข Period Span = 3: Current period + 2 previous periods combined
โข And so on...
Example: A 3-period Weekly composite VWAP calculates from the start of 2 weeks ago through the current week's end, creating a single VWAP that represents 21 days of continuous price and volume data. This provides context about where price stands relative to the volume-weighted average over multiple weeks, not just the current week.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง KEY FEATURES & ORIGINALITY
โ DUAL OPERATING MODES
1๏ธโฃ MANUAL MODE (5 Independent VWAPs)
Define up to 5 separate VWAP calculations with custom start/end times:
โข Perfect for anchoring VWAP to specific events (earnings, Fed announcements, major reversals)
โข Each VWAP has independent color settings for lines and deviation band backgrounds
โข Individual control over calculation extension and visual extension (explained below)
โข Useful for tracking multiple institutional accumulation/distribution zones simultaneously
2๏ธโฃ AUTO MODE (Composite Period VWAP)
Automatically calculates VWAP across combined time periods:
โข Supported periods: Daily, Weekly, Monthly, Quarterly, Yearly
โข Configurable period span (1-20 periods)
โข Always up-to-date, recalculates on each new bar
โข Ideal for systematic analysis across consistent timeframes
โ DUAL EXTENSION SYSTEM (Manual Mode Innovation)
Most VWAP indicators only offer "on/off" for extending calculations. This indicator provides two distinct extension options:
๐น EXTEND CALCULATION TO CURRENT BAR
When enabled, continues including new bars in the VWAP calculation after the defined end time. The VWAP value updates dynamically as new volume enters the market.
Use case: You anchored VWAP to a major low 3 weeks ago. You want the VWAP to continue evolving with new volume data to track ongoing institutional positioning.
๐น EXTEND VISUAL LINE ONLY
When enabled (and calculation extension is disabled), projects the "frozen" VWAP value forward as a reference line. The VWAP value remains fixed at what it was at the end time, but the line and deviation bands visually extend to current price.
Use case: You want to see how price is behaving relative to the VWAP that existed at a specific point in time (e.g., "Where is price now vs. the 5-day VWAP that existed at last Friday's close?").
This dual system gives you unprecedented control over whether you're tracking a "living" VWAP that incorporates new data or using historical VWAP levels as static reference points.
โ CUSTOMIZABLE STANDARD DEVIATION BANDS
โข Adjustable multiplier (0.1 to 5.0)
โข Independent background colors with opacity control for each VWAP
โข Dashed band lines for easy visual distinction from main VWAP
โข Bands extend when visual extension is enabled, maintaining zone visibility
โ COMPREHENSIVE LABELING SYSTEM
Each VWAP displays:
โข Current VWAP value
โข Upper deviation band value (High)
โข Lower deviation band value (Low)
โข Extension status indicator (Calc Extended / Visual Extended)
โข Color-coded for quick identification
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ HOW TO USE THIS INDICATOR
๐ฏ SCENARIO 1: EVENT-ANCHORED VWAP (Manual Mode)
Use case: A stock gaps down 15% on earnings and you want to track where institutions are positioning during the recovery.
Setup:
1. Switch to Manual Mode
2. Enable VWAP 1
3. Set Start Time to the earnings gap bar
4. Set End Time to current time (or leave far in future)
5. Enable "Extend Calculation to Current Bar"
6. Watch how price respects the VWAP as a dynamic support/resistance
Interpretation:
โข Price above VWAP = buyers in control since the event
โข Price testing VWAP from above = potential support
โข Volume-weighted standard deviation bands show normal price range
โข Price outside bands = potential exhaustion/mean reversion setup
๐ฏ SCENARIO 2: MULTI-WEEK INSTITUTIONAL ACCUMULATION ZONE (Auto Mode)
Use case: You trade swing setups and want to identify where institutions have been accumulating over the past 3 weeks.
Setup:
1. Switch to Auto Mode
2. Select "Weekly" period type
3. Set Period Span to 3
4. Enable standard deviation bands
Interpretation:
โข 3-week composite VWAP shows the true average institutional entry
โข Price bouncing off VWAP repeatedly = strong support (institutions defending their average)
โข Price breaking below VWAP on high volume = potential distribution
โข Deviation bands contracting = consolidation; expanding = volatility increase
๐ฏ SCENARIO 3: COMPARING MULTIPLE TIME HORIZONS (Manual Mode)
Use case: You want to see short-term vs medium-term vs long-term VWAP alignments.
Setup:
1. Switch to Manual Mode
2. VWAP 1: Last 5 trading days (blue)
3. VWAP 2: Last 10 trading days (orange)
4. VWAP 3: Last 20 trading days (purple)
5. Enable "Extend Calculation" for all
6. Set different background colors for visual separation
Interpretation:
โข All VWAPs aligned upward = strong trend across all timeframes
โข Price between VWAPs = finding equilibrium between different trader timeframes
โข Short-term VWAP crossing long-term VWAP = momentum shift
โข Price rejecting at higher-timeframe VWAP = that timeframe's traders defending their average
๐ฏ SCENARIO 4: HISTORICAL VWAP REFERENCE LEVELS (Manual Mode)
Use case: You want to see where the 1-month VWAP was at each month-end as static reference levels.
Setup:
1. Switch to Manual Mode
2. VWAP 1: Set to last month's start/end dates
3. VWAP 2: Set to 2 months ago start/end dates
4. VWAP 3: Set to 3 months ago start/end dates
5. Disable "Extend Calculation"
6. Enable "Extend Visual Line Only"
Interpretation:
โข Each VWAP represents the volume-weighted average for that complete month
โข These become static support/resistance levels
โข Price returning to old monthly VWAPs = institutional memory/gap fill behavior
โข Useful for identifying longer-term value areas
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐จ CUSTOMIZATION OPTIONS
GENERAL SETTINGS
โข Show/hide labels
โข Line style: Solid, Dashed, or Dotted
โข Standard deviation multiplier (impacts band width)
โข Toggle standard deviation bands on/off
MANUAL MODE (Per VWAP)
โข Custom start and end times
โข Line color picker
โข Background color picker (with transparency control)
โข Extend calculation option
โข Extend visual option
โข Show/hide individual VWAPs
AUTO MODE
โข Period type selection (Daily/Weekly/Monthly/Quarterly/Yearly)
โข Period span (1-20 periods)
โข Line color
โข Background color (with transparency control)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก TRADING APPLICATIONS
โ Mean Reversion: Use deviation bands to identify stretched prices likely to return to VWAP
โ Trend Confirmation: Price sustained above VWAP = bullish bias; below = bearish bias
โ Support/Resistance: VWAP often acts as dynamic S/R, especially on higher volume periods
โ Institutional Positioning: Multi-day/week VWAPs show where large players have established positions
โ Entry Timing: Wait for pullbacks to VWAP in trending markets
โ Stop Placement: Use VWAP ยฑ standard deviation as volatility-adjusted stop levels
โ Breakout Confirmation: Breakouts from consolidation with price reclaiming VWAP = stronger signal
โ Multi-Timeframe Analysis: Compare short vs long-period VWAPs to gauge momentum alignment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ IMPORTANT NOTES
โข The indicator redraws on each bar to maintain accurate visual representation (uses `barstate.islast`)
โข Maximum lookback is limited to 5000 bars for performance optimization
โข Time range calculations work across all timeframes but are most effective on intraday to daily charts
โข Standard deviation bands assume volume-weighted distribution; extreme events may violate assumptions
โข Auto mode always calculates to current bar; use Manual mode for fixed historical periods
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is open-source. Feel free to examine the code, learn from it, and adapt it to your needs.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ OVERVIEW
VWAP Composite is an advanced volume-weighted average price (VWAP) indicator that goes beyond traditional single-period VWAP calculations by offering composite multi-period analysis and unprecedented customization. This indicator solves a common problem traders face: traditional VWAP resets at arbitrary intervals (session start, day, week), but significant price action and volume accumulation often spans multiple periods. VWAP Composite allows you to anchor VWAP calculations to any timeframeโor combine multiple periods into a single composite VWAPโgiving you a true representation of average price weighted by volume across the exact periods that matter to your analysis.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ HOW IT WORKS - CALCULATION METHODOLOGY
๐ CORE VWAP CALCULATION
The indicator calculates VWAP using the standard volume-weighted formula:
โข Typical Price = (High + Low + Close) / 3
โข VWAP = ฮฃ(Typical Price ร Volume) / ฮฃ(Volume)
This calculation is performed across user-defined time periods, ensuring each bar's contribution to the average is proportional to its trading volume.
๐ STANDARD DEVIATION BANDS
The indicator calculates volume-weighted standard deviation to measure price dispersion around the VWAP:
โข Variance = ฮฃ[(Typical Price - VWAP)ยฒ ร Volume] / ฮฃ(Volume)
โข Standard Deviation = โVariance
โข Upper Band = VWAP + (StdDev ร Multiplier)
โข Lower Band = VWAP - (StdDev ร Multiplier)
These bands help identify overbought/oversold conditions relative to the volume-weighted mean, with high-volume price excursions having greater impact on band width than low-volume moves.
๐ COMPOSITE PERIOD METHODOLOGY (Auto Mode)
Unlike traditional VWAP that resets at fixed intervals, Auto Mode creates composite VWAPs by combining the current period with N previous periods:
โข Period Span = 1: Current period only (standard VWAP behavior)
โข Period Span = 2: Current period + 1 previous period combined
โข Period Span = 3: Current period + 2 previous periods combined
โข And so on...
Example: A 3-period Weekly composite VWAP calculates from the start of 2 weeks ago through the current week's end, creating a single VWAP that represents 21 days of continuous price and volume data. This provides context about where price stands relative to the volume-weighted average over multiple weeks, not just the current week.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง KEY FEATURES & ORIGINALITY
โ DUAL OPERATING MODES
1๏ธโฃ MANUAL MODE (5 Independent VWAPs)
Define up to 5 separate VWAP calculations with custom start/end times:
โข Perfect for anchoring VWAP to specific events (earnings, Fed announcements, major reversals)
โข Each VWAP has independent color settings for lines and deviation band backgrounds
โข Individual control over calculation extension and visual extension (explained below)
โข Useful for tracking multiple institutional accumulation/distribution zones simultaneously
2๏ธโฃ AUTO MODE (Composite Period VWAP)
Automatically calculates VWAP across combined time periods:
โข Supported periods: Daily, Weekly, Monthly, Quarterly, Yearly
โข Configurable period span (1-20 periods)
โข Always up-to-date, recalculates on each new bar
โข Ideal for systematic analysis across consistent timeframes
โ DUAL EXTENSION SYSTEM (Manual Mode Innovation)
Most VWAP indicators only offer "on/off" for extending calculations. This indicator provides two distinct extension options:
๐น EXTEND CALCULATION TO CURRENT BAR
When enabled, continues including new bars in the VWAP calculation after the defined end time. The VWAP value updates dynamically as new volume enters the market.
Use case: You anchored VWAP to a major low 3 weeks ago. You want the VWAP to continue evolving with new volume data to track ongoing institutional positioning.
๐น EXTEND VISUAL LINE ONLY
When enabled (and calculation extension is disabled), projects the "frozen" VWAP value forward as a reference line. The VWAP value remains fixed at what it was at the end time, but the line and deviation bands visually extend to current price.
Use case: You want to see how price is behaving relative to the VWAP that existed at a specific point in time (e.g., "Where is price now vs. the 5-day VWAP that existed at last Friday's close?").
This dual system gives you unprecedented control over whether you're tracking a "living" VWAP that incorporates new data or using historical VWAP levels as static reference points.
โ CUSTOMIZABLE STANDARD DEVIATION BANDS
โข Adjustable multiplier (0.1 to 5.0)
โข Independent background colors with opacity control for each VWAP
โข Dashed band lines for easy visual distinction from main VWAP
โข Bands extend when visual extension is enabled, maintaining zone visibility
โ COMPREHENSIVE LABELING SYSTEM
Each VWAP displays:
โข Current VWAP value
โข Upper deviation band value (High)
โข Lower deviation band value (Low)
โข Extension status indicator (Calc Extended / Visual Extended)
โข Color-coded for quick identification
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ HOW TO USE THIS INDICATOR
๐ฏ SCENARIO 1: EVENT-ANCHORED VWAP (Manual Mode)
Use case: A stock gaps down 15% on earnings and you want to track where institutions are positioning during the recovery.
Setup:
1. Switch to Manual Mode
2. Enable VWAP 1
3. Set Start Time to the earnings gap bar
4. Set End Time to current time (or leave far in future)
5. Enable "Extend Calculation to Current Bar"
6. Watch how price respects the VWAP as a dynamic support/resistance
Interpretation:
โข Price above VWAP = buyers in control since the event
โข Price testing VWAP from above = potential support
โข Volume-weighted standard deviation bands show normal price range
โข Price outside bands = potential exhaustion/mean reversion setup
๐ฏ SCENARIO 2: MULTI-WEEK INSTITUTIONAL ACCUMULATION ZONE (Auto Mode)
Use case: You trade swing setups and want to identify where institutions have been accumulating over the past 3 weeks.
Setup:
1. Switch to Auto Mode
2. Select "Weekly" period type
3. Set Period Span to 3
4. Enable standard deviation bands
Interpretation:
โข 3-week composite VWAP shows the true average institutional entry
โข Price bouncing off VWAP repeatedly = strong support (institutions defending their average)
โข Price breaking below VWAP on high volume = potential distribution
โข Deviation bands contracting = consolidation; expanding = volatility increase
๐ฏ SCENARIO 3: COMPARING MULTIPLE TIME HORIZONS (Manual Mode)
Use case: You want to see short-term vs medium-term vs long-term VWAP alignments.
Setup:
1. Switch to Manual Mode
2. VWAP 1: Last 5 trading days (blue)
3. VWAP 2: Last 10 trading days (orange)
4. VWAP 3: Last 20 trading days (purple)
5. Enable "Extend Calculation" for all
6. Set different background colors for visual separation
Interpretation:
โข All VWAPs aligned upward = strong trend across all timeframes
โข Price between VWAPs = finding equilibrium between different trader timeframes
โข Short-term VWAP crossing long-term VWAP = momentum shift
โข Price rejecting at higher-timeframe VWAP = that timeframe's traders defending their average
๐ฏ SCENARIO 4: HISTORICAL VWAP REFERENCE LEVELS (Manual Mode)
Use case: You want to see where the 1-month VWAP was at each month-end as static reference levels.
Setup:
1. Switch to Manual Mode
2. VWAP 1: Set to last month's start/end dates
3. VWAP 2: Set to 2 months ago start/end dates
4. VWAP 3: Set to 3 months ago start/end dates
5. Disable "Extend Calculation"
6. Enable "Extend Visual Line Only"
Interpretation:
โข Each VWAP represents the volume-weighted average for that complete month
โข These become static support/resistance levels
โข Price returning to old monthly VWAPs = institutional memory/gap fill behavior
โข Useful for identifying longer-term value areas
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐จ CUSTOMIZATION OPTIONS
GENERAL SETTINGS
โข Show/hide labels
โข Line style: Solid, Dashed, or Dotted
โข Standard deviation multiplier (impacts band width)
โข Toggle standard deviation bands on/off
MANUAL MODE (Per VWAP)
โข Custom start and end times
โข Line color picker
โข Background color picker (with transparency control)
โข Extend calculation option
โข Extend visual option
โข Show/hide individual VWAPs
AUTO MODE
โข Period type selection (Daily/Weekly/Monthly/Quarterly/Yearly)
โข Period span (1-20 periods)
โข Line color
โข Background color (with transparency control)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก TRADING APPLICATIONS
โ Mean Reversion: Use deviation bands to identify stretched prices likely to return to VWAP
โ Trend Confirmation: Price sustained above VWAP = bullish bias; below = bearish bias
โ Support/Resistance: VWAP often acts as dynamic S/R, especially on higher volume periods
โ Institutional Positioning: Multi-day/week VWAPs show where large players have established positions
โ Entry Timing: Wait for pullbacks to VWAP in trending markets
โ Stop Placement: Use VWAP ยฑ standard deviation as volatility-adjusted stop levels
โ Breakout Confirmation: Breakouts from consolidation with price reclaiming VWAP = stronger signal
โ Multi-Timeframe Analysis: Compare short vs long-period VWAPs to gauge momentum alignment
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ IMPORTANT NOTES
โข The indicator redraws on each bar to maintain accurate visual representation (uses `barstate.islast`)
โข Maximum lookback is limited to 5000 bars for performance optimization
โข Time range calculations work across all timeframes but are most effective on intraday to daily charts
โข Standard deviation bands assume volume-weighted distribution; extreme events may violate assumptions
โข Auto mode always calculates to current bar; use Manual mode for fixed historical periods
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is open-source. Feel free to examine the code, learn from it, and adapt it to your needs.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.