OPEN-SOURCE SCRIPT

VWAP – Pivot Pairs (SECONDS‑BASED RESET)

56
VWAP – Pivot Pairs (SECONDS-BASED RESET) is a Pine Script v6 indicator for TradingView that combines pivot-based breakout detection with resettable VWAP (Volume Weighted Average Price) calculations over user-defined rolling time periods in seconds.It identifies high and low swing pivots via breakout logic, then calculates two VWAP lines per anchor:One using high/low as the price source,
One using close as the price source.

These form "pivot pairs" that reset automatically at the start of each custom-duration period (e.g., every 300 seconds), starting from a user-defined UTC time of day (default: 09:30 UTC).Visuals include:Colored VWAP lines (high pair: red, low pair: green),
Semi-transparent fill zones between each pair,
Optional toggles to show/hide high or low pairs.

Use CasesUse Case
Description
Intraday Scalping (1–15 min charts)
Use 60–300 second resets to capture micro-trends within larger sessions. VWAP pairs act as dynamic support/resistance after breakouts.
High-Frequency / Algo Validation
Backtest strategies on tick/second charts where traditional session resets fail. Align resets with exchange micro-sessions or volatility windows.
Opening Range Breakout (ORB) Enhancement
Set period_seconds = 1800 (30 min) and start time = 09:30 UTC → VWAP builds only on first 30 mins post-open, then floats. Pairs show deviation from ORB mean.
Range-Bound Market Analysis
In choppy markets, VWAP pairs converge near fair value. Divergence signals potential breakout. Fill color intensity shows conviction.
Multi-Timeframe Confluence
Overlay on 1-second chart with 300s reset → matches 5-minute structure. Use close-based VWAP for entries, high/low-based for stops.

Key Features SummaryFeature
Function
period_seconds
Rolling window length in seconds (e.g., 300 = 5 min)
period_start_time
UTC time-of-day anchor (default: 09:30)
new_period logic
Triggers full reset of pivots + VWAP on exact second boundary
breakingHigher / breakingLower
Detects confirmed breakouts (not just close above high)
Dual VWAP per anchor
ta.vwap(high) and ta.vwap(close) for range-aware mean
Fill zones
Visual value area between high/close VWAPs
Toggle visibility
Independently show/hide high or low pivot pairs

How It Works – Step-by-StepTime Engine Converts user inputs → milliseconds
Calculates current period start time using integer division from epoch
Detects exact bar when new period begins (new_period = true)

On New Period Resets both high/low anchors to current bar’s h and l
Forces VWAP recalculation from this bar forward

Breakout Detection Only triggers on strong candles (rising/falling, non-doji)
Requires open/close beyond prior pivot → avoids wicks-only breaks

VWAP Accumulation ta.vwap(source, reset_condition) restarts when anchor resets
Two sources per side → shows where volume clustered (at highs vs closes)

Plotting Four lines + two fills
Clean, customizable, overlay-friendly

Pro TipsUse on Heikin Ashi for smoother breakout signals.
Combine with volume profile to validate VWAP clusters.
For crypto, set period_start_time = 0 (00:00 UTC) for clean 4-hour resets.
Add alerts on new_period or breakingHigher for automation.

In short: This is a precision VWAP tool for time-boxed, pivot-driven mean reversion and breakout trading, ideal for scalpers, day traders, and algo developers needing sub-session granularity.


免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。