The previous day high low breakout strategy buys when price crosses above yesterday’s high and sells short when price crosses below yesterday’s low, using the opposite level as the stop. I backtested it on Nifty futures 1 minute data from September 2010 to October 2017: it made money both long/short and long only (about 17% a year), but with deep drawdowns of 34% to 47%. This post shares the rules, the results, the AmiBroker AFL code and what you should change before testing it today.
Do simple strategies really work in Indian Markets? This curiosity arises when one of our Amibroker Mumbai Participant comes up with a simple trading strategy. Hence the tutorial series, Do Simple Strategies Really Works?. This tutorial series explores the space of simple rules, easy to practice, easy to adapt and the to explore if there is any real edge with the simple rules.
Lets kickstart with the very simple trading strategy,
Buy if the price touches previous day high with stop loss as previous day low
Sell if the price touches previous day low with stop loss as previous day high
as the day progress previous day high and previous day low will be acting like a trailing stop loss. It is a simple long-short system where the system is always in position.
- Rules: buy on a touch of the previous day high, short on a touch of the previous day low; the other level is the stop and reverse point.
- Long/short returned 17.22% a year with a 47% drawdown; long only returned 17.41% with a 34% drawdown, on 2010 to 2017 Nifty futures data.
- The short side alone lost money, which is why long only had better risk adjusted results.
- Win rate was low (37% to 40%), so the system depends on a few large winners and needs patience through long drawdowns.
- Costs have risen since 2018: STT on futures is 0.05% from April 2026 and the Nifty lot size is 65, so rerun the test with current costs.
Previous Day High Low Breakout Strategy Rules

- Long entry: price trades above the previous day high plus a 1 point filter.
- Short entry: price trades below the previous day low minus a 1 point filter.
- Stop and reverse: a long position is closed and reversed when the previous day low is broken, and vice versa, so the system is always in the market.
- Trailing: each new day brings new previous day levels, so the stop trails automatically.
- Gaps: if the market opens beyond the level, the trade is taken at the open price.
Backtest Setup
To test this rules written a simple Amibroker AFL Code where the entry is limit order as the entry levels are predefined (Either your previous day high or low is your entry point) and if there is any gap down situation at open then buying/shorting at price is considered. And the AFL code is programmed accordingly to get the appropriate backtesting results.
| Symbol | Nifty Futures |
| Timeframe | 1 min |
| Trade Execution | LMT order at a touch of price level & MKT order in case of Gap up/ Gap Down |
| Dataset Length | Sep 2010 – Oct 2017 |
| Trading Commissions + Slippages | 0.02% |
| Initial Capital | 3,00,000 |
| Position Sizing | 2lots or 150 shares per trade (Fixed shares) |
| Filter | 1 point filter from entry level |
If you are using a discount broker like Tradejini, Zerodha, Upstox theoretical commissions works out to 0.01% in case of futures whereas with full broker theoretical commissions will be bit higher. Since there are gap up and gap down situations, where one cannot exactly punch orders at the open price of the candle hence market orders are placed which eventually results in extra slippages. So a theoretical value of 0.02% is used whereas in real life it could be even much higher depends on how volatile markets are when it is opening with gap up or gap down. Higher the volatile or emotional higher your slippage would be.
Backtest Results: Long/Short vs Long Only
| Backtesting Metrics | Long/Short | Long Only |
| Initial Capital | 3,00,000 | 3,00,000 |
| Ending Capital | 9,30,581 | 9,41,319 |
| Net Profit | 6,30,581 | 6,41,319 |
| Annual Return % | 17.22% | 17.41% |
| Total Trades | 797 | 399 |
| Winning Ratio | 37% | 40% |
| Drawdown | -47% | -34% |
| Sharp Ratio | 0.43% | 0.91% |
| Avg Profit/Loss | 791 | 1607 |
| Profitable Months | 54 out of 86 months | 56 out of 86 months |
A note on reading the table: the Sharpe ratio values (0.43 and 0.91) are ratios rather than percentages. Dividing annual return by maximum drawdown gives about 0.37 for long/short and about 0.51 for long only, which confirms that the long only version gave more return for each unit of drawdown.
Equity Curve – Trading Long/Short

Equity Curve – Long only

Trading strategy makes money undoubtedly in both long/short and long-only system. However, it tends to lose money when only short is practised. Overall performance of long-only is good in terms of risk and returns in comparison with the long-short system. In long-only system drawdown is controlled, profitability is increased. But still there are emotional phases where it goes through the extensive drawdown in terms of money and time which will definitely test the patience of any trader.
Previous Day High Low Breakout AFL Code
The AmiBroker AFL code used for this backtest is below, as a GitHub gist and as plain text. It reads the previous day high and low with TimeFrameGetPrice(), adds an optimisable filter, and sets BuyPrice and ShortPrice to the worse of the open or the level, so gap openings are filled at the open.
//Coded by Rajandran R (Founder of Marketcalls and Co-Founder of Traderscafe.in
//Website : www.marketcalls.in
//Date : 16 Apr 2018
_SECTION_BEGIN("Simple Trading System - Previous Day High Low Breakout");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(EncodeColor( colorGold) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Price", colorDefault, styleCandle );
// Go Long - if prev day high is broken and stop loss prev day low
// Go Short - if prev day low is broken and stop loss prev day high
SetPositionSize(150,spsshares);
PDH = TimeFrameGetPrice("H",inDaily,-1);
PDL = TimeFrameGetPrice("L",inDaily,-1);
//Trade Entry/Exit Filter
iFilter = Optimize("Filter",1,1,100,1);
Plot(PDH+ifilter,"Upper",colorGreen,styleLine | styleThick);
Plot(PDL-ifilter,"Lower",colorRed,styleLine | styleThick);
//Trading Rules for touch of levels
Buy = Cross(H,PDH+ifilter);
Sell = Cross(PDL-ifilter,L);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = Sell;
Cover = Buy;
//Trade Execution Price - Gap Up and Gap Down Execution Rules Considered
BuyPrice = Max(Open,PDH+ifilter);
SellPrice = Min(Open,PDL-ifilter);
ShortPrice = Min(Open,PDL-ifilter);
CoverPrice = Max(Open,PDH+ifilter);
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);
_SECTION_END();
Download Amibroker AFL Code Previous day High Low Breakout Strategy
If you want only the levels for your own system, see the one hour high-low and previous day high low code snippet.
What Has Changed Since This 2018 Backtest
- Lot size: the test used 150 shares, which was 2 lots of 75 at the time. The Nifty lot size is 65 for contracts from January 2026 (Angel One), so 2 lots is now 130 units. Change
SetPositionSize(150,spsshares)to 130 if you want to keep a 2 lot test. - Costs: STT on futures was raised from 0.02% to 0.05% with effect from 1 April 2026 (Business Today). With brokerage, exchange charges and slippage, the 0.02% assumption in the table is now too low; I would test with at least 0.05% to 0.06% per side.
- Expiry day: NSE equity derivatives contracts expiring on or after 1 September 2025 expire on Tuesday, with monthly contracts on the last Tuesday of the month (Moneylife). Since this system holds positions overnight, plan rollovers around the new expiry day.
Limitations of This Simple Strategy
- Overnight risk: the system is always in position, so gap openings against you add slippage beyond the planned stop.
- Long drawdowns: a 34% to 47% drawdown in money, and many months to recover, is hard to sit through with real capital.
- Same bar triggers: on a volatile 1 minute bar that touches both levels, the backtest cannot know which came first.
- Single instrument, single period: the results are for Nifty futures from 2010 to 2017. Test other periods and instruments before trusting the edge.
- Filter optimisation: the AFL lets you optimise the filter from 1 to 100 points; pick a value that works across a range, not the single best one.
Before you trade any variation, go through these 7 things to understand to do proper backtesting, and if you are new to AmiBroker backtesting, start with the introduction to backtesting a trading system using AmiBroker.
Frequently Asked Questions
Does the previous day high low breakout strategy work?
In my 2010 to 2017 test on Nifty futures it was profitable, at about 17% a year, but with large drawdowns and a low win rate. The long side did the work; the short side alone lost money.
What is the success rate of this strategy?
The winning ratio was 37% for long/short and 40% for long only. The strategy relies on winners being much larger than losers rather than on a high hit rate.
Which timeframe is best for this breakout strategy?
The levels come from the daily chart, but the entries need an intraday chart to catch the exact touch. This test used 1 minute data so the limit order fills could be modelled correctly.
How do I add a filter to the strategy?
The AFL adds a filter in points above the high and below the low. You can also add a trend filter, such as trading only long when price is above a long term moving average, which fits the result that long only performed better.
Learn by watching: free videos every week
Market Profile, order flow, Python, AI and OpenAlgo tutorials on YouTube.


Dear Sir,
Please provide any free site or software where I can get the daily, weekly and monthly data of stocks in the same view.
This strategy makes money in a trending market , nifty was sideways/flat at 5000 levels from 2010 to 2013 loses money. Also SAR will loose money if the markets become volatile.
please put back test afl also back test not posble
What happens if both high & low breakdown happens on the same day?? How to backtest it on daily data(without Intraday Data), I mean without knowing which breakout happened first in this case?
We put Buy stoploss and high and sell stop loss and low. which ever first touches is the entry and other would be the stoploss.