S&P VWAP Band Reversion
A rule-based intraday strategy for the S&P 500. From 09:30 ET it draws the session VWAP with bands two standard deviations above and below it.
- Market
- the S&P 500, under the names it trades as.
- Runs on
- any of those symbols on a feed that quotes the whole 18:00-17:00 ET session, 5-minute chart (recommended).
Free on request during the launch period.
Open on TradingViewThe rules, in full
- VWAP and bands: the volume-weighted average price from 09:30 ET, plus or minus 2 volume-weighted standard deviations. They are built from 1-minute data.
- Bars: 5-minute blocks counted from 09:30 ET.
- Short: the bar's high reaches the upper band, it closes back below the band, it closes below its open, its upper wick is at least 2 x its body, and it closes above VWAP.
- Long: the bar's low reaches the lower band, it closes back above the band, it closes above its open, its lower wick is at least 2 x its body, and it closes below VWAP.
- The signal bar must end between 10:00-11:30 ET or 13:30-14:30 ET (both ends included).
- Day filters: no trade on major US news days (FOMC, CPI, jobs report, ISM manufacturing and services). When a signal appears, the day is also skipped if the 09:30-10:30 ET range so far is wider than 1.02 x R. U = the median full-session (18:00-17:00) range of the prior 20 complete sessions; it sizes the stops. R = the median 09:30-16:00 range of the same sessions. Holiday and incomplete sessions are left out. If U or R is not available, the day is skipped.
- Entry: market order after the signal bar closes (it fills at the next bar's open). Only the first signal is used, and at most one trade per day. Orders are placed only on an accepted S&P 500 symbol unless the market lock override is on.
- Stop: 1.0 x U from the fill. From then on the stop trails 1.0 x U behind the best price reached on completed bars, and it never moves back.
- No profit target. Any trade still open is closed at 16:10 ET.
That is the whole rule set, exactly as published. Nothing is held back for subscribers.
What you see on the chart
- A green ▲ LONG label below the signal bar or a red ▼ SHORT label above it. Hover for the price, the stop and the exit rule. The signal-bar highlight is optional.
- An "EXIT +/- pts" label at each exit. Hover for the reason (Stop, Trailing stop or Time exit) and the P/L.
- An orange VWAP line and purple upper and lower bands during 09:30-16:00 ET. Blue shading shows while a signal window is open.
- In a trade: a white entry line at the real fill price, a red stop line and a light red zone between them. The stop line shows the stop that was working during each bar, up to and including the exit bar (a new trailing level applies from the next bar, as in the Strategy Tester); the Stop name at its right end shows the stop working now. There is no target line.
- Each line is named with its price at its right end (VWAP, Upper band, Lower band, Entry, Stop).
- A compact status box (top right) shows: the symbol and how it was read (S&P 500 futures / index / CFD / ETF); the state (WAITING, SETUP, ENTERING LONG / SHORT on the signal bar, IN LONG / IN SHORT with the stop, DONE with a short reason, OFF on a wrong symbol or timeframe); VWAP and band levels, or entry and stop while in a trade; and the signal count with the days loaded. Hover a row for more. Turn on "Show details" for U and the stop size, the opening-hour range against its limit (1.02 x R), the windows, today's news-day check and the next step.
- An orange row appears on a non-futures symbol: on an index / CFD feed about size and commission in Properties, on an ETF about the missing 18:00 ET session.
- A red banner appears on any symbol that is not an S&P 500 instrument (no orders unless the override is on). An orange banner appears on a timeframe that is not 5-minute or 1-minute (no orders). A small yellow tip appears on the 1-minute chart.
Alerts
1. Add the strategy to a 5-minute chart of an S&P 500 symbol - ES1!, MES1!, SPX500, US500...
2. Create Alert: Condition = this strategy, then "alert() function calls only". TradingView calls this a technical alert, and a free Basic account cannot create one - Basic allows 3 price alerts and no technical alerts at all, so the Create Alert dialog will not let you save it. Essential is the lowest plan that works (20 technical alerts); Plus 100, Premium 400. On Essential and Plus an alert also expires after two months and has to be created again; on Premium and Ultimate it does not expire. Phone notifications themselves are free on every plan - tick "Notify on app" and have the TradingView app installed and signed in on the same account.
3. Each message is one short line: what happened and at what price first, then the exchange and ticker, then the extras separated by "|". Nothing else to read.
LONG 6012.25 on CME_MINI:ES1! | SL 5998.50 | trail 13.75 pts | no TP | fills next open
LONG FILLED 6012.50 on CME_MINI:ES1! | SL 5998.75 | trail 13.75 pts | no TP
EXIT 6026.25 on CME_MINI:ES1! | Trailing stop | +13.75 pts | position 0
EXIT at market on OANDA:SPX500USD | time exit 16:10 ET | fills next open
The ticker is in every line, so you can watch several S&P 500 symbols at once and still tell them apart at a glance. Alerts are per chart: create one on each symbol you want watched.
4. Messages fire once per bar close. Three toggles in the Alerts group: the signal, the fill and the exit.
5. On a free Basic account, which has no technical alerts, the last status-box row shows "Price alert: ▲<upper band> ▼<lower band>" and a plain price alert on the symbol is free. Read the row's tooltip first: these bands are rebuilt on every bar, so a fixed price alert chases a moving level and will fire away from where the band ends up - re-read the row and edit the alert each time you look at the chart. It is a rough "price is far from VWAP" ping, not a signal, so open the chart before acting.
Settings
- Signal: band width 2.0 sigma, wick at least 2 x body, windows 10:00-11:30 and 13:30-14:30 ET.
- Day filters: opening-hour limit 1.02 x R, skip news days (on), extra skip dates, and U and R from 20 sessions within 40 days.
- Stops and exits: initial stop 1.0 x U, trailing 1.0 x U, flat by 16:10 ET.
- The strategy is designed around these defaults. Changing them changes the strategy.
- Market lock: "Override market lock (allow non-S&P symbols)" (off by default). The S&P 500 is recognised by its contract root or ticker together with the instrument type, so futures, index / CFD feeds and the S&P 500 ETFs are accepted while a single share is not. Turn the override on only to experiment elsewhere.
- Alerts, Display Options and Colors.
- Properties default to 100,000 USD initial capital, 1 contract, no pyramiding, 0.95 USD commission per contract per side (micro) and 1 tick slippage. Enter your own size and cost for the instrument you trade - these defaults are wrong for full-size ES, for an index CFD (where 1 contract is 1 index point) and for an ETF.
Limits, and what this cannot do
- Pine fills at the next bar's open plus 1 tick and estimates the price path inside each bar (stops are judged from bar high/low). Results on chart bars can differ from live fills.
- VWAP and bands come from 1-minute bars, not from every trade, so they can differ slightly from a tick-based VWAP. If 1-minute data is not available, the chart's own bars are used.
- On the 5-minute chart the trailing stop moves once per 5-minute bar, and a first stop is placed from the signal close so the entry bar is protected. On the 1-minute chart the stop moves every minute and starts from the minute after entry.
- The built-in news-day list runs through 2026-12-31. After that, add news dates yourself in "Extra skip dates" (format YYYYMMDD, comma separated). Extra skip dates only apply while "Skip major US news days" is on.
- Different S&P 500 symbols are different data: a CFD feed, a futures contract and an ETF do not print the same bars, do not keep the same hours and do not start their daily bar at the same time, so the same rule produces a different trade list on each. Read each one on its own chart.
- U and R are built from 15-minute bars and need 20 prior complete sessions of the full electronic session (18:00-17:00 ET). Keep the chart on the full session, not RTH only, or the day shows "U not ready". That rules out the S&P 500 ETFs entirely and any CFD feed that pauses overnight. On futures use a continuous contract (ES1! / MES1!). Roll adjustment and data gaps can shift them.
- On early-close days, change the windows and the flat time by hand.
- The script only sees its own trades.
Educational tool. Not financial advice. Past behaviour does not predict future results.
Before you decide
The script page on TradingView carries TradingView's own Strategy Tester report, generated by TradingView from this script. We do not write those numbers and we do not repeat them here. Read them at the source: S&P VWAP Band Reversion on TradingView.