
Chapter 4 | 2 min read
Algo Strategy: VWAP Strategy – Trade Like Big Players
You’ve probably heard this word tossed around in trading circles — VWAP.
But what does it really mean?
VWAP = Volume Weighted Average Price
It tells you the average price a stock has traded at throughout the day, but weighted by volume.
Institutions — like mutual funds and FIIs — often use VWAP as a benchmark. Many of their buy/sell orders are designed to execute around VWAP so they don’t disturb the market.
That’s why VWAP-based algo strategies can be very powerful.
What is VWAP?
Let’s break it down simply:
Imagine a stock trades like this during the day:
9:15 | ₹100 | 1,000 |
10:00 | ₹102 | 2,000 |
11:00 | ₹98 | 500 |
The simple average price would be ₹100.
But VWAP would be weighted based on volume. So, the ₹102 trade has more “weight” than the ₹98 trade.
This gives a more accurate picture of where actual money is flowing.
How VWAP is Used in Algos
-
Buy below VWAP, Sell above VWAP
If the stock is trading below VWAP, it’s considered cheap — algo may trigger a buy.
If it’s trading above VWAP, it’s seen as expensive — algo may sell. -
Reversion to VWAP
Some algos assume price will revert to VWAP — especially after a sharp move. Buy when it dips way below, and sell when it comes close. -
VWAP Crossover
Buy when price crosses above VWAP (bullish momentum). Sell or short when it crosses below VWAP
Example
Stock ABC has VWAP of ₹150.
At 10:30 AM:
- Current price: ₹145 (way below VWAP)
- Algo thinks: “Smart money may step in to buy soon”
→ It enters long → Targets ₹149–₹150 → Tight stoploss at ₹143
Quick trade, using volume-backed logic.
import yfinance as yf
import pandas as pd
def calculate_vwap(df: pd.DataFrame) -> pd.Series:
"""Session-reset VWAP using typical price ((H+L+C)/3)."""
tp = (df['High'] + df['Low'] + df['Close']) / 3
session = df.index.date
cum_pv = (tp * df['Volume']).groupby(session).cumsum()
cum_v = df['Volume'].groupby(session).cumsum()
return cum_pv / cum_v # <- returns a Series
#Download recent intraday data
symbol = "AAPL" # use NSE tickers like "RELIANCE.NS" if needed
df = yf.download(symbol, period="5d", interval="5m")
#Calculate VWAP
df['VWAP'] = calculate_vwap(df)
#Strategy parameters (mean-reversion toward VWAP)
deviation_threshold = 3.0 #enter if price is >3% below VWAP
stop_loss_points = 2.0 #fixed SL below entry
target_offset_points = 0.5 #target slightly under VWAP
signals = []
for ts, row in df.iterrows():
vwap = row['VWAP']
price = row['Close']
if pd.notna(vwap) and price < vwap * (1 - deviation_threshold / 100.0):
entry = price
target = vwap - target_offset_points
stop = entry - stop_loss_points
signals.append({
'Time': ts,
'Entry Price': round(entry, 2),
'VWAP': round(vwap, 2),
'Target': round(target, 2),
'Stop Loss': round(stop, 2),
'Comment': 'Long: far below VWAP, expecting bounce'
})
signals_df = pd.DataFrame(signals)
print(signals_df)
signals_df.to_csv("vwap_mean_reversion_signals.csv", index=False)
Why Algos Love VWAP
- Dynamic: Changes with time and trades
- Objective: Not based on guesswork or emotions
- Volume-backed: Helps filter fake moves
Watch Out
- Resets daily, so best suited for intraday trades, not swing position
- Ineffective in low-volume stocks
- Can give false signals during news events or sudden gaps
Pro Tip
Many algos also use multiple VWAPs:
- Day VWAP
- Hourly VWAP
- Anchored VWAP (from a particular event like budget day or earnings)
VWAP strategies bring you closer to how smart money thinks. And with algos, you can act as fast as them.
Next, we’ll wrap this module with a cool, futuristic strategy — Sentiment-Driven Algos.
Recommended Courses for you
Beyond Stockshaala
Discover our extensive knowledge center
Learn, Invest, and Grow with Kotak Videos
Explore our comprehensive video library that blends expert market insights with Kotak's innovative financial solutions to support your goals.













