PROTECTED SOURCE SCRIPT

VWAP Regime Filter V6

24

## **VWAP Regime Filter V6**

### Overview
This indicator classifies market conditions into distinct regimes based on VWAP (Volume Weighted Average Price) gradient analysis. By measuring how much VWAP has moved over a lookback period, it identifies whether the market is in a **Mean Reversion**, **Trend Continuation**, or **Observe Only** state — helping traders align their strategy with current market conditions.

### How It Works
The indicator calculates the VWAP gradient (change in ticks) over a configurable lookback period:
- **Mean Reversion** (Blue) — VWAP is flat, suggesting price may revert to the mean
- **Trend Continuation Long** (Green) — VWAP rising strongly, favor long bias
- **Trend Continuation Short** (Purple) — VWAP falling strongly, favor short bias
- **Observe Only** (Gray) — VWAP movement is inconclusive, exercise caution

### Key Features
- **Dual Timeframe Analysis** — Compare short-term (10 bars) and long-term (50 bars) VWAP gradients with four confirmation modes:
- *ShortOnly* — Use short lookback only
- *LongOnly* — Use long lookback only
- *BothMustAgree* — Both timeframes must show same regime
- *LongConfirmsShort* — Short triggers, long must not contradict

- **Anti-Flicker Logic** — Prevents rapid regime changes (zebra effect) by requiring consecutive bars to confirm a regime change

- **Visual Regime Shading** — Color-coded fill between VWAP bands for easy historical analysis

- **Real-Time Dashboard** — Displays current regime, gradient values, and mode settings

- **Configurable Alerts** — Get notified when regime changes occur

### Settings Guide
| Parameter | Default | Description |
|-----------|---------|-------------|
| Short Lookback | 10 | Bars for short-term gradient |
| Long Lookback | 50 | Bars for long-term gradient |
| Flat Threshold | 4 ticks | Maximum gradient for Mean Reversion |
| Trend Threshold | 40 ticks | Minimum gradient for Trend Continuation |
| Anti-Flicker Bars | 3 | Consecutive bars needed to confirm regime change |

### How To Use
1. **Mean Reversion Regime** — Consider fading moves away from VWAP, look for reversals at the bands
2. **Trend Continuation Regime** — Trade with the trend, use pullbacks to VWAP as entry opportunities
3. **Observe Only Regime** — Reduce position size or wait for clearer conditions

### Notes
- Gradient thresholds may need adjustment based on the instrument and timeframe
- The anti-flicker feature helps avoid whipsaws but adds slight lag to regime detection
- Works best when combined with other confluence factors (support/resistance, volume, etc.)

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.