VWAP Mean Reversion Strategy with Session and Volume Filter by AIScripts

By AIScripts

Performance Metrics

Description

Description:Volume Weighted Average Price, is one of the most referenced levels on any intraday chart. It appears on almost every institutional trading desk as a benchmark for execution quality: did you buy below VWAP or above it? Did you sell above it or below it? That institutional significance is what makes it useful as a trading level, not because it is a magical support and resistance line, but because enough participants are watching it and acting around it that it creates real, observable price behavior.This strategy is built around one of the most consistent behaviors VWAP produces: mean reversion. In sessions with no strong directional trend, price tends to oscillate around VWAP rather than trending away from it indefinitely. When price moves significantly above VWAP in a non-trending session, institutional sellers often step in, bringing price back toward the average. When price moves significantly below VWAP, buyers who missed the open use VWAP as a reference level for value. The result is a gravitational pull back toward VWAP that is observable, repeatable, and, with the right filters, tradable.What VWAP Actually MeasuresVWAP is calculated by summing the product of price and volume for every transaction during a session, then dividing by total volume. The result is the average price at which the instrument has traded during the day, weighted by how much traded at each price. A stock trading at $102 when VWAP is $100 means that, on average, every share transacted during the session changed hands at $100, and the current price is 2% above that average. Whether that premium is justified depends on whether volume is expanding in the direction of the move or shrinking, which is exactly what this strategy checks.VWAP resets every session. This is important: VWAP is an intraday concept. Using it on daily charts or holding positions across sessions removes the institutional context that makes it meaningful. This strategy trades only within the active session for that reason.The Mean Reversion LogicEntries fire when two conditions are met simultaneously. First, price must have moved a defined distance away from VWAP, measured in ATR multiples to scale the threshold to the instrument's actual volatility rather than a fixed percentage. Second, volume on the move away from VWAP must be declining relative to its recent average. This second condition is the critical filter. A price move away from VWAP accompanied by expanding volume suggests a real directional move with genuine participation, shorting into that is dangerous. A move away from VWAP on declining volume suggests the move is losing conviction and the pull back to VWAP is more likely.When price is above VWAP by more than the ATR threshold and volume is declining, a short entry fires. When price is below VWAP by more than the ATR threshold and volume is declining, a long entry fires. The target for both is VWAP itself — not a fixed ATR level, but the actual VWAP value at the time the target would be hit. Stop-loss is placed at an ATR multiple beyond the entry in the opposite direction from VWAP.Session FilterThe strategy only trades between 9:45 AM and 3:15 PM ET. The first 15 minutes after the NYSE open are excluded deliberately. The opening session is when the largest institutional orders are being executed, VWAP has barely formed, and the spread between price and VWAP frequently reflects genuine price discovery rather than mean reversion opportunity. Trading into the first 15 minutes with a mean reversion approach is trading against the most aggressive order flow of the day. The final 45 minutes are excluded because end-of-day institutional rebalancing often moves price away from VWAP and keeps it there through the close, a mean reversion entry in that window frequently doesn't have time to play out before the session ends and the position needs to be closed.What This Strategy Works Best WithVWAP mean reversion is most effective on highly liquid instruments where institutional participation is consistently high, major equity indices, large-cap individual stocks, and equity index futures. On thinly traded instruments, VWAP is less meaningful as a reference level because the institutional volume that creates the gravitational pull isn't present. On crypto markets, VWAP mean reversion can work but requires adjusting the session definition since crypto trades continuously, not in defined daily sessions.What to Watch in BacktestingPerformance will vary significantly by market regime. In strongly trending sessions, where a catalyst like an earnings surprise, a Fed announcement, or a macro data release drives sustained directional movement, mean reversion against the trend produces losing trades. This is expected and not a flaw. Check the strategy's performance separately on trending days versus range-bound days if you can identify them. The most useful insight from backtesting this strategy is often not the aggregate win rate but the distribution of trade outcomes across different session types.Shared for educational purposes and community discussion. This is not investment advice. Always backtest on your own instruments and timeframes using realistic commission assumptions before drawing any conclusions.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView