VWAP Gravity Bands [JOAT]VWAP Gravity Bands is an open-source Pine Script v6 overlay that builds an anchored VWAP field with a smoothed T3 basis and ATR ladder bands. It is designed to show how far price has traveled from a session, weekly, or monthly value anchor, then classify that distance as center pull, ladder drift, expansion, or outer-band reaction.
The script is useful when a trader wants the chart to show both location and behavior around VWAP. Instead of a single VWAP line, it creates a full distance map around the anchor, colors candles by their distance from the basis, and highlights confirmed outer reactions without using arrow-style signal clutter.
Core Concepts
1. Anchored VWAP Selection
The anchor can reset on the session, week, or month. The script uses timeframe.change() to produce the reset pulse and ta.vwap() to calculate the anchored value.
anchorTimeframe = anchorChoice == "Week" ? "1W" : anchorChoice == "Month" ? "1M" : "1D"
anchorPulse = timeframe.change(anchorTimeframe)
rawVwap = ta.vwap(sourceInput, anchorPulse)
2. T3 Basis Smoothing
Raw anchored VWAP can move sharply at the beginning of an anchor period. VWAP Gravity Bands runs that value through a T3-style smoother to create a cleaner basis while preserving responsiveness.
e1 = ta.ema(src, length)
e2 = ta.ema(e1, length)
e3 = ta.ema(e2, length)
basis = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
3. ATR Ladder Bands
The band ladder is based on ATR, not fixed percentages. This lets the distance field expand and contract with the market's current movement range.
ladderUnit = atr * bandStep
upperOne = basis + ladderUnit
lowerOne = basis - ladderUnit
upperThree = basis + ladderUnit * 3.0
lowerThree = basis - ladderUnit * 3.0
4. Distance State Model
Distance from VWAP is normalized by the ladder unit. The script classifies large directional continuation as expansion and failed outer-band tests as reactions.
5. Gradient Candle Coloring
Candles can be colored by their normalized distance from VWAP. This helps identify when price is balanced around the anchor, drifting away from it, or stretched toward an outer band.
Features
Session, weekly, or monthly anchor: Select the VWAP reset period from inputs
T3-smoothed VWAP basis: Cleaner centerline for visual trend and location analysis
ATR ladder bands: Three upper and lower bands scale with current volatility
Expansion state detection: Highlights directional movement away from the basis
Outer reaction detection: Marks confirmed failed tests near the outer ladder
Distance candle mode: Optional gradient candles based on normalized VWAP distance
Dashboard: Shows anchor, state, distance, ATR step, and basis slope
Alert conditions: Upper reaction, lower reaction, upper expansion, and lower expansion
Input Parameters
Visual System:
Palette Preset: Selects color pair
Distance Candles: Enables candle coloring by VWAP distance
Dashboard: Shows top-right state panel
Raw VWAP: Displays the unsmoothed anchored VWAP
Outer Reaction Marks: Shows compact TP-style outer reaction markers
VWAP Gravity:
Anchor: Session, Week, or Month
Source: Price source used for VWAP
T3 Basis Length: Smoothing length for the VWAP basis
T3 Factor: Controls T3 smoothness
ATR Length: Volatility length used for ladder distance
ATR Step: Distance between ladder bands
Expansion Step: Threshold for expansion classification
Reaction Step: Threshold for outer reaction classification
How to Use This Indicator
Step 1: Choose the Anchor
Use Session for intraday context, Week for swing context, and Month for broader value location.
Step 2: Read Distance From Basis
The dashboard distance value shows how many ladder units price is away from the smoothed VWAP basis.
Step 3: Separate Expansion From Reaction
Expansion means price is moving away from VWAP with slope confirmation. Reaction means price tested an outer area and closed back inside.
Step 4: Use the Bands as Context
The bands are not automatic entry levels. They show location. Combine them with market structure, candle behavior, and risk planning.
Indicator Limitations
VWAP is volume-based and may behave differently on symbols with sparse volume
The first bars after a new anchor can be less stable because VWAP is starting a new sample
Reaction markers show a confirmed close back inside a zone, not a future reversal forecast
ATR bands adapt to volatility but can widen quickly after large bars
Originality Statement
VWAP Gravity Bands is original in how it combines anchored VWAP selection, T3 smoothing, ATR ladder geometry, distance-colored candles, and separate expansion/reaction states. It is built from public Pine v6 functions and original logic rather than copied indicator source.
Disclaimer
This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. VWAP location and band reactions can fail in trending, news-driven, or low-liquidity markets. Always use independent analysis and proper risk management.
-Made with passion by jackofalltrades
Indikator Pine Script®






















