Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

VWAP Intraday Trading Strategy: Do Simple Trading Strategies Really Work? [Part4]

2 min read

Do simple Trading strategies really work in Indian Markets? It is the curiosity remains among most of the traders. Does a simple technical condition bring consistent returns in the markets despite commissions and slippages?

To test this hypothesis, we took a strategy which is quite popular in social media – VWAP based intraday trading strategy. Here are the rules

VWAP is a simple day trading strategy where we use previous day’s end of day (EOD) VWAP and current day VWAP

When an instrument is trading above previous day closing VWAP, it is bullish and if it is trading below, it is bearish

Nifty Futures – VWAP Intraday Trading Strategy ( 15min Timeframe)

Nifty Futures VWAP Intraday Trading Strategy
Yellow Thick Line – VWAP , Brown Dotted Line – Yesterdays VWAP closing
Greeline Line – Target Levels , Red Line Stop levels

Chart time frame: 15 minutes

Buy entry: When instrument crosses high of Bullish 15 min candle which touched and closed above current day VWAP

Sell entry: When instrument crosses Below Low of Bearish 15 min candle which touched and closed below current day VWAP

Target: 30 Points for Nifty, 90 Points for Bank Nifty and 1.5 % stocks

SL: 20 Points for Nifty, 60 Points for Bank Nifty and 1 % stocks

We tested the trading strategy in Nifty Futures and Bank Nifty Futures right from Jan 2011 to Dec 2019. Here are the backtest results.

VWAP based intraday trading system - backtest results for Nifty and Bank Nifty Futures

VWAP Based Intraday Strategy – Amibroker AFL code

_SECTION_BEGIN("Yesterdays VWAP Strategy");

TargetPrice = Param("Target Points",30,1,500,1);
StopPrice = Param("Stop Points",20,1,500,1);
N = Param("Limit Trades",1,1,10,1); //Per Symbol Trade Limit

SetPositionSize(1*RoundLotSize,spsShares); // Bactest Calculation for No of Points

marketstarttime = 091500;
sigendtime = 144449;
sqofftime = 151459;


Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == marketstarttime , BarIndex());
TodayVolume = iif(Sum(V,Bars_so_far_today) <= 0,1,Sum(V,Bars_so_far_today));
average = (H+L+C)/3;
IIf (BarIndex() >= StartBar, VWAP = Sum (average * V, Bars_so_far_today  ) / TodayVolume,0);


newday = Ref(Day(),-1) != Day();

yVWAP = ValueWhen(newday, Ref(VWAP,-1) ,1);

Plot(yVWAP,"yVWAP",colorBrown,styleDashed);
Plot(VWAP,"yVWAP",colorYellow,styleLine | styleThick);

sqoff = TimeNum() >=sqofftime;


dn = DateNum();
newDay = dn != Ref( dn,-1);

Buy = C>yVWAP AND Cross(C,VWAP) AND TimeNum()<=sigendtime;

Buy = Buy AND Sum( Buy, BarsSince( newDay) +1 ) <= N;  //Limit to one trade per day


BuyPrice = ValueWhen(Buy,Close); //Enter at Close of the candle

TargetBuy = BuyPrice + TargetPrice;
StopBuy = BuyPrice - StopPrice;


Sell = Cross(H,TargetBuy) OR Cross(StopBuy,L) OR sqoff; //Exit if Target/Stop/Square off Time reached

SellPrice = IIf(Cross(H,TargetBuy), TargetBuy, IIf(Cross(StopBuy,L), StopBuy, Close));

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

BuyCont = Flip(Buy,Sell);
SellCont = Flip(Sell,Buy);

Short = C< yVWAP AND Cross(VWAP,C) AND TimeNum() <= sigendtime;
Short = Short AND Sum( Short, BarsSince( newDay) +1 ) <= N;  //Limit to one trade per day


ShortPrice = ValueWhen(Short,Close);

TargetShort = ShortPrice - TargetPrice;
StopShort = ShortPrice + StopPrice;


Cover = Cross(H,StopShort) OR Cross(TargetShort,L) OR sqoff; //Exit if Target/Stop/Square off Time reached
CoverPrice = IIf(Cross(H,StopShort), StopShort, IIf(Cross(TargetShort,L), TargetShort, Close));

Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);

ShortCont = Flip(Short,Cover);
CoverCont = Flip(Cover,Short);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

PlotShapes(Sell * shapestar, colorBrightGreen, 0, High, 12);
PlotShapes(Cover * shapestar, colorRed, 0, Low, -12);

Plot(VWAP,"VWAP",colorYellow,styleLine | styleThick);
Plot(yVWAP,"yVWAP",colorYellow,styleDashed);

Plot(IIf(Buycont,TargetBuy,IIf(Shortcont,TargetShort,Null)),"Target",colorGreen,styleDashed | styleThick);
Plot(IIf(Buycont,StopBuy,IIf(Shortcont,StopShort,Null)),"Stop",colorRed,styleDashed | styleThick);


_SECTION_END();

_SECTION_BEGIN("Candlestick Charts");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

Conclusion

Visually strategy looks good but backtesting failed to produce impressive results. When comes to Nifty futures strategy is profitable before including reasonable trading commissions and slippages but failed to turn profitable post adding trading commissions and slippages. When comes to Banknifty futures strategy is not profitable even before including the trading cost.

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Algomojo Index Straddle/Strangle Execution Module with Intraday Stoploss

This tutorial focus on how to automate your index straddle/strangle strategy with intraday stop-loss levels with time-based entry and exits using Algomojo Platform and...
Rajandran R
7 min read

Learn How to Login into Algomojo Account using Amibroker

In the last tutorial, we learn how to automate the algomojo login process and in this video tutorial, we are going to learn with...
Rajandran R
1 min read

Amibroker Execution Module – Hedged Index Futures for Directional…

In the last tutorial, we learn the importance of Hedging Futures Position with OTM Options for Reduced Margin. This tutorial focus on how to...
Rajandran R
14 min read

5 Replies to “VWAP Intraday Trading Strategy: Do Simple Trading Strategies Really…”

  1. For all the hype about this strategy, it turns out to be a losing proposition! Nice analysis!

  2. VWAP strategies always more impressive when you added on Heikenashi charts. Time frame as you mentioned 15 min.
    Buy condition: Candle should Above VWAP
    Sell condition: Candle should Below VWAP
    0.3% Targets….

    1. I have traded in real Mkt on vwap in nifty future for last 2 months daily, I feel u hav to make decision when to end a trade even before it hits SL or hit target. It rarely gives target of 35 points in nifty even if entered properly on cmp crossings vwap. It may give 20 points and then can reverse trend. Only on trending days it gives full target. So don’t rely on it blindly. Save ur capital first even if you get less profit

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More