Skip to main content

Welcome to this post, where we’ll delve into an effective trading strategy known as the Volume Breakout Trading Strategy. This strategy identifies stocks that break out of their price ranges with significant trading volumes. It’s a straightforward approach that doesn’t rely on complex indicators but has consistently delivered impressive profits. This strategy is applicable to a wide range of highly liquid and high-beta stocks, as proven through our testing. We’ve even coded an AFL (AmiBroker Formula Language) for this strategy and rigorously back-tested it on BankNifty futures traded at the NSE. The results show a compounded annual return of around 23% over the last 11 years of backtesting.

If you’re interested in learning how to code in AFL and create your trading systems, you can find a helpful guide here.

A Quick Overview of the AFL for the Volume Breakout Trading Strategy 

ParameterValue
Preferred Time-frameDaily
Indicators UsedEMA
Buy Condition
  • Volume surpasses or equals 1.5 times the volume of the previous candle.
  • Close price exceeds the 20-period simple moving average.
  • Volume is higher than the 50-period simple moving average of volume.
Short Condition
  • Volume surpasses or equals 1.5 times the volume of the previous candle.
  • Close price is below the 20-period simple moving average.
  • Volume is higher than the 50-period simple moving average of volume.
Sell Condition
  • Same as the Short condition
  • Stop Loss is triggered
  • Target is met
Cover Condition
  • Same as the Buy condition
  • Stop Loss is triggered
  • Target is met
Stop Loss3%
Targets30%
Position Size120 Quantities
Initial Equity200,000
Brokerage100 per order
Margin10%

AFL Code

				
					//------------------------------------------------------
//
//  Formula Name:    Volume Breakout Trading System
//  Website:         zerobrokerageclub.com
//------------------------------------------------------

_SECTION_BEGIN("Volume Breakout Trading System");

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 ) ) ));

//Initial Parameters

SetTradeDelays( 1, 1, 1, 1 );
SetOption( "InitialEquity", 200000);
SetOption("FuturesMode" ,True);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",100);
SetOption("AccountMargin",10);
SetOption("RefreshWhenCompleted",True);
SetPositionSize(120,spsShares);
SetOption( "AllowPositionShrinking", False );
BuyPrice=Open;
SellPrice=Open;
ShortPrice=Open;
CoverPrice=Open;

//Buy-Sell Logic

range=High-Low;

VolLookback=Param("VolLookback",50,10,100,10);
MALookback=Param("MALookback",20,10,100,10);

Buy = Volume>=Ref(Volume,-1)*1.5 AND Close>MA(Close,MALookback) AND Volume>MA(Volume,VolLookback) ;
Short =Volume>=Ref(Volume,-1)*1.5 AND Close<MA(Close,MALookback) AND Volume>MA(Volume,VolLookback);
Cover = Buy; 
Sell=Short;

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

printf("\nBuy : " + Buy );  
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  
printf("\nVolume : " + Volume );  	

StopLoss=Param("SL",3,1,10,1);
Target=Param("Target",30,5,40,5);
ApplyStop(Type=0,Mode=1,Amount=StopLoss);
ApplyStop(Type=1,Mode=1,Amount=Target);


Plot( Close, "Price", colorWhite, styleCandle );
Plot(MA(Close,MALookback),"",colorYellow);


/* Plot Buy and Sell Signal Arrows */
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(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, 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);


_SECTION_END();
				
			

AFL Screenshot

Backtest Report for the Volume Breakout Trading Strategy

ParameterValue
BankNifty
Initial Capital200,000
Final Capital1,973,764.04
Scrip NameNSE Banknifty
Backtest Period25-Aug-2005 to 17-June-2016
TimeframeDaily
Net Profit %886.88%
Annual Return %23.09%
Number of Trades78
Winning Trade %37.18%
Average Holding Period19.28 periods
Maximum Consecutive Losses10
Maximum System % Drawdown-34.03%
Maximum Trade % Drawdown-75.56%

The backtest report reveals that the drawdown is relatively high. To mitigate this risk, you can implement effective Risk Management strategies. You can also download the comprehensive backtest report here.

Equity Curve

Volume-Breakout-Trading-Strategy-Equity-Curve

Profit Table

This volume breakout trading strategy has proven to be profitable in all years except for 2015 and 2012.

Volume-Breakout-Trading-Strategy-Profit-Table

Additional AmiBroker Settings for Backtesting

For more accurate backtesting, navigate to Symbol–>Information and specify the lot size and margin requirements. In the screenshot below, you can see a lot size of 40 and a margin requirement of 10% for NSE BankNifty:

2 Comments

Leave a Reply