The rules at a glance
- Market: Nifty 50 futures (NSE:NIFTY1!) on the 5-minute chart; the VWAP needs volume, which the index itself doesn't have
- Trend: the VWAP is higher than it was 6 candles ago (lower for shorts)
- Entry: the previous candle closed above the VWAP, this one dips to it and closes back above it as a bullish candle; enter at that close
- Stop loss: below the signal candle's low, minus a quarter of the ATR
- Target: twice the risk (2R); anything still open is closed at 3:15 p.m.
- Limits: new trades from 9:45 a.m. to 2:30 p.m., two trades a day at most, whole lots only
What the VWAP is
For every candle since the open, take its typical price (the average of its high, low and close) and multiply it by the volume traded in that candle. Add those up, and divide by the total volume so far. That's the VWAP. It starts again at the next day's open.
Because it's weighted by volume, the VWAP tells you the average price at which today's buyers and sellers actually traded. Many large traders measure their fills against it, so it gets a lot of attention. Above it, today's buyers are in profit on average; below it, they're losing. That's why a rising VWAP with the price above it is read as a market where buyers are in control.
One practical point for Indian traders: the Nifty 50 index itself has no traded volume on TradingView, so its VWAP can't be calculated properly. Use the futures chart, NSE:NIFTY1!, which carries the real volume.
The rules, step by step
1. Let the first 30 minutes settle
The VWAP is jumpy in the first minutes, when there's little volume behind it. The script takes no trades before 9:45 a.m.
2. Check the VWAP is sloping your way
For longs, the VWAP has to be higher than it was six candles (30 minutes) ago. For shorts, lower. A flat VWAP means a sideways day, and VWAP pullbacks don't work well on those.
3. Wait for the pullback to the VWAP
The previous candle closed above the VWAP. This candle dips to it or through it, then closes back above it as a bullish candle. That's the signal: the buyers defended today's average price.
4. Stop below the candle, target 2R
The stop goes below the signal candle's low, minus a quarter of the 14-period ATR. The target is twice the risk.
5. Two trades a day, out by 3:15 p.m.
New trades only until 2:30 p.m., at most two a day, and anything still open is closed at 3:15 p.m. Many brokers close intraday (MIS) positions on their own near the end of the session; check your broker's time.
Worked example: Nifty 50 futures, 5-minute chart
VWAP
The day opens strong and the VWAP rises with it. By 10:05 a.m. the price is more than 40 points above the VWAP, then it eases back. At 10:30 a.m. a candle dips to 25,079.00, below the VWAP at about 25,092, and closes back above it at 25,102.50 as a bullish candle. The VWAP is rising and the candle before closed above it: that's the long signal.
| Nifty futures long | |
|---|---|
| Entry | 25,102.50 |
| Stop loss | 25,073.40 (candle low 25,079.00 minus a quarter of the ATR), 29.1 points away |
| Target (2R) | 25,160.70, 58.2 points away |
| Account and risk | ₹5,00,000, risking 1% = ₹5,000 |
| Units the risk allows | ₹5,000 ÷ 29.1 points = 171 units |
| Units the margin allows | 90% of ₹5,00,000 ÷ (12% of 25,102) = 149 units |
| Position | 130 units = 2 lots of 65 |
| Loss if the stop is hit | 29.1 × 130 = ₹3,783 |
| Profit at the target | 58.2 × 130 = ₹7,566 |
Here the stop was tight enough that the risk budget alone would have allowed 171 units, but the margin available limits the position to 149, and whole lots bring it down to 2 lots. The actual risk is about ₹3,800, under the ₹5,000 budget. The target is reached at 11:15 a.m., about 40 minutes after the entry.
VWAP strategies compared
| Approach | Idea | Suited to |
|---|---|---|
| VWAP pullback (this page) | Buy dips to a rising VWAP, sell rallies to a falling one | Trending days |
| VWAP cross | Buy when the price crosses above the VWAP, sell below | Turning points; gives many false signals on flat days |
| VWAP bands | Fade moves to 2 standard deviations away from the VWAP | Sideways days |
| Anchored VWAP | Start the VWAP from a chosen event, such as a gap or a result day | Swing levels over several days |
The pullback version is a common place to start, because it trades with the day's direction and has an obvious place for the stop.
Risk management for Nifty futures
- Check what one lot risks. At 65 units a lot, a 30-point stop is ₹1,950 a lot before costs.
- Mind the margin. Futures need margin for the whole position. With a tight stop, margin, not your risk percentage, often sets the position size, as in the example.
- Count the costs. Brokerage, STT, exchange charges and GST are paid on every trade, and an intraday strategy pays them often.
- Skip event days if unsure. RBI policy, the budget and big US data can turn a calm VWAP day into a whipsaw.
- Remember the odds. SEBI's study found that 93% of individual traders in equity futures and options lost money over FY22 to FY24.
Common mistakes
- Using the index chart. The Nifty index has no volume on TradingView, so its VWAP isn't meaningful. Use NIFTY1!.
- Trading a flat VWAP. On sideways days the price crosses the VWAP again and again.
- Buying every touch. The candle has to close back above the VWAP, as a bullish candle.
- Carrying the trade overnight. The VWAP resets each day; the idea behind the trade ends with the session.
On gold or forex, the VWAP uses tick volume from your data feed rather than real exchange volume, so treat it with more caution there.
Backtest it yourself on TradingView
This page doesn't quote a win rate or a profit figure, and you should be wary of anyone who does without showing the test. Results change with the market, the dates, the data feed and the costs you put in. The honest way is to run the test yourself, and the free script below does the work in a couple of minutes.
- Open the chart. On TradingView, open NSE:NIFTY1! (Nifty futures, continuous contract; not NSEIX:NIFTY1!, which is GIFT Nifty) on the 5-minute chart.
- Add the script. Open the Pine Editor from the Pine icon in the panel on the right of the chart (older layouts have it as a tab under the chart), delete the code that's already there, paste this strategy's code and click "Add to chart".
- Put in your costs. Open the strategy's settings and go to Properties. Enter your broker's commission and a little slippage. A test without costs flatters every strategy, and short-term ones most of all.
- Read the Strategy Tester. The panel under the chart shows the net profit, the maximum drawdown, the profit factor, the number of trades and a list of every trade. Click a few trades and check on the chart that each one follows the rules. Trade sizes are shown in units rather than lots: on Nifty futures, 65 units is one lot.
- Change one setting at a time. Compare the slope check over 3, 6 and 12 candles, one trade a day against two, and the 2R target against 1.5R. Then test Bank Nifty futures: set the lot rounding input to 30, its lot size since January 2026.
As a rough guide, don't trust a result with fewer than 100 trades, a profit factor under 1 once costs are in, or a drawdown you couldn't sit through with real money. Settings tuned to look good on one stretch of history often fail on the next, so check the same settings on dates you didn't tune them on, then demo trade the strategy for a few weeks. How much history you can test depends on your TradingView plan: the free plan loads 5,000 candles, which is a few months of 15-minute candles but years of daily ones.
The script sizes each trade from the stop loss and your risk percentage, caps it at 90% of the account as margin, rounds it down to whole lots of 65 units, and starts with ₹5,00,000 at a 12% margin setting. Change the capital and margin under Properties, and the matching margin input in the script's settings, to suit your broker. By default TradingView fills orders at the open of the candle after the signal, so the fill can differ a little from the signal candle's close. With two trades a day at most and only part of the day open for entries, getting to 100 trades needs months of 5-minute data; the free plan loads about 66 sessions.
Download the free Pine Script and PDF
The script is written in Pine Script version 6 for this guide and follows the rules above. It can't read the economic calendar, so skipping news days is up to you. It's free to use, change and share. The PDF is a one-page cheat sheet with the rules, the times, a worked example in rupees and a checklist, to keep next to your chart.
Show the code (Pine Script v6, 72 lines)
//@version=6
// VWAP pullback strategy by PipLedger (https://pipledgerfx.com/vwap-trading-strategy)
// Buys pullbacks to the day's VWAP while the VWAP is rising, and sells rallies to it while it is falling. Intraday only.
// Default settings are for Nifty 50 futures (NSE:NIFTY1!) on the 5-minute chart. VWAP needs volume, so use a futures chart, not the index.
// Free to use and change. For education and backtesting only; not financial advice.
strategy("PipLedger: VWAP Pullback", shorttitle="VWAP", overlay=true, initial_capital=500000, pyramiding=0, default_qty_type=strategy.fixed, default_qty_value=1, margin_long=12, margin_short=12, currency=currency.INR)
// ---------- Inputs
tz = input.string("Asia/Kolkata", "Time zone")
tradeSess = input.session("0945-1430", "Entry window")
exitHour = input.int(15, "Close any open trade at (hour)", minval=0, maxval=23)
exitMin = input.int(15, "Close any open trade at (minute)", minval=0, maxval=59)
slopeBars = input.int(6, "VWAP must be rising (or falling) over this many candles", minval=1)
stopBuf = input.float(0.25, "Stop buffer beyond the signal candle (x ATR 14)", minval=0.0, step=0.05)
rr = input.float(2.0, "Target (R multiple)", minval=0.5, step=0.25)
maxTrades = input.int(2, "Maximum trades a day", minval=1)
qtyStep = input.float(65, "Round quantity down to whole lots of (units; 0 = no rounding)", minval=0.0)
riskPct = input.float(1.0, "Risk per trade (% of equity)", minval=0.1, maxval=5.0, step=0.1)
marginPct = input.float(12, "Margin % (set the same under Properties)", minval=0.1, step=0.5)
// ---------- Helpers
fx = strategy.convert_to_account(1.0) // one unit of the chart's currency in account currency (1 on a rupee chart)
calcQty(float entry, float stop) =>
float dist = math.abs(entry - stop)
float q = dist > 0 and not na(fx) ? strategy.equity * riskPct / 100 / (dist * syminfo.pointvalue * fx) : 0.0
float qMax = entry > 0 and not na(fx) ? strategy.equity * 0.9 / (entry * syminfo.pointvalue * fx * marginPct / 100) : 0.0
q := math.min(q, qMax) // never more than 90% of the account as margin
qtyStep > 0 ? math.floor(q / qtyStep) * qtyStep : q
newDay = timeframe.change("D")
vwap = ta.vwap(hlc3, newDay)
atr = ta.atr(14)
inTrade = not na(time(timeframe.period, tradeSess, tz))
dayBars = ta.barssince(newDay) // candles since today's first candle, so the slope check never reaches into yesterday
cutoff = timestamp(tz, year(time, tz), month(time, tz), dayofmonth(time, tz), exitHour, exitMin)
var int trades = 0
if newDay
trades := 0
// ---------- Signals: the price was on the trend side of the VWAP, dips (or rallies) to it, and closes back on the trend side
vwapUp = vwap > vwap[slopeBars]
vwapDn = vwap < vwap[slopeBars]
ok = inTrade and time_close < cutoff and trades < maxTrades and strategy.position_size == 0 and not newDay and dayBars >= slopeBars
longSig = ok and vwapUp and close[1] > vwap[1] and low <= vwap and close > vwap and close > open
shortSig = ok and vwapDn and close[1] < vwap[1] and high >= vwap and close < vwap and close < open
// ---------- Orders
if longSig
float sl = low - atr * stopBuf
float q = calcQty(close, sl)
if q > 0
strategy.entry("Long", strategy.long, qty=q)
strategy.exit("Long exit", "Long", stop=sl, limit=close + (close - sl) * rr)
trades += 1
if shortSig
float sl = high + atr * stopBuf
float q = calcQty(close, sl)
if q > 0
strategy.entry("Short", strategy.short, qty=q)
strategy.exit("Short exit", "Short", stop=sl, limit=close - (sl - close) * rr)
trades += 1
// the candle that closes at the cut-off sends the order, so it fills at the cut-off time
if strategy.position_size != 0 and (time_close >= cutoff or newDay)
strategy.close_all(comment="Intraday exit")
// ---------- Chart
plot(vwap, "VWAP", color=color.new(color.orange, 0), linewidth=2)
plotshape(longSig, "Long pullback", shape.triangleup, location.belowbar, color.teal, size=size.small)
plotshape(shortSig, "Short rally", shape.triangledown, location.abovebar, color.red, size=size.small)Trading this from India
Nifty futures and options are traded legally on NSE through a SEBI-registered broker. The rules on this page are for education and backtesting, not a forecast for any particular day. Check your broker's current margin, lot size and intraday square-off time before you trade. More on the legal side is in is forex trading legal in India and algo trading in India.
Related strategies: 9 and 21 EMA crossover, RSI 60/40, MACD and 200 EMA, Bollinger Bands squeeze, XAUUSD scalping, Nifty option selling, short strangle. All 34 strategies are compared on one page in forex trading strategies.