VWAP (Volume-Weighted Average Price)
Is the price above or below what buyers paid on average today?
The average price of every share traded so far today, with busier moments counting more. An intraday measure.
VWAP on a chart of past prices
Settings
The rule ignores the first minutes, while VWAP is based on only a few trades.
VWAP itself has no settings, so everyone watching it sees the same line. The one slider here only changes when the classic rule may start trading.
What it measures
VWAP is an intraday measure: it starts again at 9:15 am every trading day and only counts that day's trades. For each candle it takes the typical price, (high + low + close) ÷ 3, multiplies it by the shares traded, adds that up since the open, and divides by all the shares traded since the open.
That makes it the average price paid today, with busy candles counting more than quiet ones. Large funds use it as a yardstick: buying below the day's VWAP counts as a good price.
That is why this page uses 15-minute candles: on a daily chart every candle is a whole day, and VWAP would just be that day's typical price. VWAP also has no settings, so everyone watching it sees the same number.
How traders read it
- Price above VWAP: today's buyers are, on average, sitting on a gain, and intraday traders read the day as strong. Below: weak.
- The classic intraday rule, tested here: buy when a 15-minute candle closes above VWAP, sell when one closes below it, and close everything before 3:30 pm. Marked on the chart.
- Early in the day VWAP moves a lot, because few trades are counted yet; by the afternoon it barely moves.
The traps
Daily charts break it
VWAP on daily candles is not the VWAP intraday traders quote. Use it on intraday candles only.
Chop around the line
On a quiet day the price crosses VWAP many times, and each crossing is an intraday trade with charges.
Intraday costs add up
Every intraday round trip pays brokerage, STT, exchange and other charges. The test below counts them on every trade.
Test the classic rule: VWAP cross (intraday)
Waiting for prices…
Quick check
Waiting for prices…
Use it in a script
function run(bars, ta, helpers) {
const vwap = ta.sessionVwap(bars);
const signals = [];
let day = "", inTrade = false;
for (let i = 0; i < bars.length; i++) {
const date = helpers.istDate(bars[i]), minute = helpers.istMinute(bars[i]);
if (date !== day) { day = date; inTrade = false; } // new day: yesterday's position was squared off
if (minute < 555 + 15) continue; // wait 15 minutes after 9:15 am (minute 555)
const above = bars[i].close > vwap[i];
if (!inTrade && above && minute < 900) { // no new buys after 3:00 pm (minute 900)
signals.push(helpers.buy(i));
inTrade = true;
} else if (inTrade && (!above || minute >= 915)) { // closed below VWAP, or the 3:15 pm candle
signals.push(helpers.sell(i));
inTrade = false;
}
}
return signals;
}This is the rule tested above, with the settings on your sliders, and it gives exactly the same buy and sell candles. Paste it into the Scripts drawer of the chart workbench, or save it and compare it across stocks in the Strategy Lab. New to scripts? The Writing strategies track starts from zero.
In the reference:ta.sessionVwaphelpers.istMinutehelpers.istDate