Volume Breakout Trading Strategy: Amibroker AFL

In this post, we are going to discuss a volume breakout trading strategy which scans for stocks which breaks out of a price range with high volumes. This is a very simple strategy with no fancy indicators, however the profitability is quite impressive. This works on majority of liquid and high beta stocks that we have tested. We have a coded an AFL for this strategy and back-tested it on Banknifty futures traded at NSE. The compounded annual return is around 23% for the last 11 years backtest period.

Please visit Trading Tuitions Academy to learn AFL coding and create your own Trading systems.

Volume Breakout Trading Strategy – AFL Overview

Parameter Value
Preferred Time-frame
Indicators Used EMA
Buy Condition
  • Volume is greater than or equal to 1.5 times of previous candle’s volume.
  • Close is greater than 20 period simple moving average.
  • Volume is greater than 50 period simple moving average of volume.
Short Condition
  • Volume is greater than or equal to 1.5 times of previous candle’s volume.
  • Close is less than 20 period simple moving average.
  • Volume is greater than 50 period simple moving average of volume.
Sell Condition
  • Same as Short
  • Stop Loss Hit
  • Target met
Cover Condition
  • Same as Buy
  • Stop Loss Hit
  • Target met
Stop Loss 3%
Targets 30%
Position Size 120 Quantities
Initial Equity 200000
Brokerage 100 per order
Margin 10%

Volume Breakout Trading Strategy – AFL Code

//  Formula Name:    Volume Breakout Trading System
//  Author/Uploader: Trading Tuitions
//  E-mail:          support@tradingtuitions.com
//  Website:         www.tradingtuitions.com

_SECTION_BEGIN("Volume Breakout Trading System");

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C ));

//Initial Parameters

SetTradeDelays( 1, 1, 1, 1 );
SetOption( "InitialEquity", 200000);
SetOption("FuturesMode" ,True);
SetOption( "AllowPositionShrinking", False );

//Buy-Sell Logic



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 CloseMA(Volume,VolLookback);
Cover = Buy; 

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

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


Plot( Close, "Price", colorWhite, styleCandle );

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


AFL Screenshot

Volume Breakout Trading Strategy

Volume Breakout Trading Strategy – Backtest Report

Parameter Value
Initial Capital 200000
Final Capital 1973764.04
Scrip Name NSE Banknifty
Backtest Period 25-Aug-2005 to 17-June-2016
Timeframe Daily
Net Profit % 886.88%
Annual Return % 23.09%
Number of Trades 78
Winning Trade % 37.18%
Average holding Period 19.28 periods
Max consecutive losses 10
Max system % drawdown -34.03%
Max Trade % drawdown -75.56%

Clearly, drawdown is on a higher side. It could be overcome with proper Risk Management strategies. Download the detailed backtest report here.

Equity Curve

Volume Breakout Trading Strategy Equity Curve

Profit Table

This volume breakout trading strategy has been profitable on all the years except 2015 and 2012.

Volume Breakout Trading Strategy Profit Table.PNG

Additional Amibroker settings for backtesting

Goto Symbol–>Information, and specify the lot size and margin requirement. The below screenshot shows lot size of 40 and margin requirement of 10% for NSE Banknifty:

Banknifty Symbol Information


All the AFL’s posted in this section are for learning purpose. Trading Tuitions does not necessarily own these AFL’s and we don’t have any intellectual property rights on them. We might copy useful AFL’s from public forums and post it in this section in a presentable format. The intent is not to copy anybody’s work but to share knowledge. If you find any misleading or non-reproducible content then please inform us at support@tradingtuitions.com

Related Posts


  1. _N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C ));

    I am getting Error 61. The number of format specifier(s) (%) does not match the number of arguments passed.

    Please help

    _N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C ));

    • Hi Vaibhave,

      This happens on some versions of Amibroker. Please comment out this line for the time being. It wouldn’t affect the strategy at all.

Leave a Reply

Your email address will not be published. Required fields are marked *