VWAP Suite | Trend & Mean Reversion with Adaptive Filters

Overview
This strategy is built around a custom volume-weighted average price (VWAP) engine with standard-deviation bands, and gives you two complete, independently-tuned trading modes in a single script:
Trend Following — trades breakouts/crossovers in the direction of VWAP's own momentum
Mean Reversion — trades stretched price extremes back toward VWAP, filtered for low-trend conditions
Rather than assuming one style of market behavior, this script lets you choose the mode that matches what you're trading — a trending momentum stock, or a calmer range-bound one — and includes a layered filter system designed to keep you out of low-quality setups in either mode.
How VWAP Is Calculated
VWAP weights price by the volume traded at that price, rather than treating all price ticks equally — so it reflects where the real trading activity concentrated, not just a simple average.
This script computes it manually (not via a black-box built-in), which allows for flexible anchoring:
Session — resets daily (best for lower timeframes, intraday charts)
Week — resets weekly (better for 1H–4H charts)
Month — resets monthly (for swing/position-style testing)
Standard deviation bands are plotted at three levels (1, 2, and 3 std dev by default), giving visual reference points for "normal," "stretched," and "extreme" price deviation from the volume-weighted average.
Strategy Modes
Trend Following
Mean Reversion
Filter System (False-Signal Reduction)
Every entry — in either mode — passes through a shared base filter layer before mode-specific logic is applied:
Each filter can be toggled independently, so you can isolate which conditions matter most for the instrument and timeframe you're trading.
Optional Confluence Layer
A secondary indicator can be layered on top of either mode:
Risk Management
Visuals
Important Notes Before Use
Match your anchor period to your timeframe. Session anchoring is built for intraday charts; on higher timeframes (2H+), Week or Month anchoring will produce more reliable slope readings, since Session resets can occur every few bars and distort trend measurement.
Backtest results include commission assumptions but not slippage — adjust the commission/slippage settings in the strategy properties to reflect your actual broker before drawing conclusions from performance metrics.
This script is provided for research and educational purposes. Past performance in backtesting does not guarantee future results. Always forward-test on a paper account before committing real capital.
This strategy is built around a custom volume-weighted average price (VWAP) engine with standard-deviation bands, and gives you two complete, independently-tuned trading modes in a single script:
Trend Following — trades breakouts/crossovers in the direction of VWAP's own momentum
Mean Reversion — trades stretched price extremes back toward VWAP, filtered for low-trend conditions
Rather than assuming one style of market behavior, this script lets you choose the mode that matches what you're trading — a trending momentum stock, or a calmer range-bound one — and includes a layered filter system designed to keep you out of low-quality setups in either mode.
How VWAP Is Calculated
VWAP weights price by the volume traded at that price, rather than treating all price ticks equally — so it reflects where the real trading activity concentrated, not just a simple average.
This script computes it manually (not via a black-box built-in), which allows for flexible anchoring:
Session — resets daily (best for lower timeframes, intraday charts)
Week — resets weekly (better for 1H–4H charts)
Month — resets monthly (for swing/position-style testing)
Standard deviation bands are plotted at three levels (1, 2, and 3 std dev by default), giving visual reference points for "normal," "stretched," and "extreme" price deviation from the volume-weighted average.
Strategy Modes
Trend Following
- Looks for price to break through VWAP (or an outer band) in a direction confirmed by VWAP's own slope — the idea being that VWAP acting as support/resistance and trending in your trade's direction adds conviction to the move.
- Three selectable entry triggers: VWAP Cross, Band 1 Break, Band 2 Break
- VWAP slope filter (with adjustable lookback and minimum slope %) to avoid trading flat/directionless VWAP
- Take-profit targets at the opposite band or at VWAP itself
- Best suited for: momentum-driven, higher-volatility names where trends persist once established.
Mean Reversion
- Looks for price to overextend beyond a chosen band, then trades the snap-back toward VWAP. Includes an ADX filter to specifically avoid taking reversion trades during strongly trending conditions (where "buying the dip" or "fading the rip" is historically much riskier).
- Three selectable entry triggers: Outside Band, Band Cross, Band Reclaim (wick-and-recover confirmation — the most conservative/false-signal-resistant option)
- ADX filter caps entries below a configurable trend-strength threshold
- Maximum VWAP deviation cap (in ATR units) to avoid catching a falling knife on extreme extensions
- Best suited for: range-bound, lower-volatility names where price oscillates predictably around a stable average.
Filter System (False-Signal Reduction)
Every entry — in either mode — passes through a shared base filter layer before mode-specific logic is applied:
- Volume Filter: Requires volume above a multiple of its recent average, filtering out low-conviction moves
- Volatility (ATR) Filter: Requires a minimum ATR (as % of price) to avoid dead, directionless conditions
- Band Width Filter: Avoids trading when bands are unusually tight (a sign of indecision and high whipsaw risk)
- VWAP Slope Filter (Trend mode): Confirms VWAP itself is moving meaningfully in the trade direction, not just flat
- ADX Filter (Mean Reversion mode): Blocks entries when the broader trend is too strong to safely fade
Each filter can be toggled independently, so you can isolate which conditions matter most for the instrument and timeframe you're trading.
Optional Confluence Layer
A secondary indicator can be layered on top of either mode:
- RSI — for trend mode, confirms momentum direction; for mean reversion, confirms oversold/overbought exhaustion via a crossover trigger
- EMA Regime (200-period default) — acts as a higher-level trend filter, only allowing longs above the EMA and shorts below it
Risk Management
- Risk-based position sizing — position size is calculated from your risk % input divided by stop distance, not a fixed share count
- Maximum position size cap (% of equity) — acts as a hard ceiling so tight-stop trades can't produce oversized positions
- Two stop-loss methods — ATR-multiple based, or band-based (using the outer bands as structural stop references)
- Two take-profit methods — opposite band target, or VWAP itself
- Optional fixed take-profit lock — freezes the target price at entry rather than letting it drift with VWAP
- Optional break-even stop — moves the stop to entry once a configurable ATR-multiple of profit is reached
Visuals
- VWAP line color-shifts between two colors depending on whether price is above or below it
- Three-tier shaded band system for at-a-glance visual reference of price deviation
- Entry markers (triangle up/down) plotted directly on signal bars
- Background shading during filtered/no-trade conditions, so you can visually see why the strategy stayed flat
Important Notes Before Use
Match your anchor period to your timeframe. Session anchoring is built for intraday charts; on higher timeframes (2H+), Week or Month anchoring will produce more reliable slope readings, since Session resets can occur every few bars and distort trend measurement.
Backtest results include commission assumptions but not slippage — adjust the commission/slippage settings in the strategy properties to reflect your actual broker before drawing conclusions from performance metrics.
This script is provided for research and educational purposes. Past performance in backtesting does not guarantee future results. Always forward-test on a paper account before committing real capital.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.