Range Bound Trading Strategy

The following system helps you identify range bound formations and when to enter and exit such trades. Range bound formations occur when prices bounce back and forth establishing a nearly identical pattern of highs and lows. An upper resistance and lower support level is created. A key point to observe is the recognition of these range bound patterns which have the common characteristic that volume diminishes. Here are the statistics for a more precise definition of range bound patterns for 15min price intervals:

Breakout % Breakout ATR Flag pole height % Flag pole ATR Pole duration (bars) Flag duration (bars) Breakout duration (bars)
Average4.8%10.14.5%814849
Median4%8.13.3%813643
90% percentile9.7%16.28.7%10.6231597
10 % percentile2%4.52%5.66315

All patterns have an average duration of 2 hours on 15min intraday bars. The average breakout lasts 1.98 days. 90% reach the target in 3.19 days. Breakout and pole pattern is measured using average true range showing the degree of price volatility.

The profit target is calculated using Pearson’s correlation coefficient between the breakout and the pole height in % and as average true range. To calculate the profit target following formula is used: Pt= V*P (Pt=profit target, V=volatility, P= pole), whereby p is expressed in percentage terms. Our backtest includes more volatile stocks with frequent breakouts. The value for the volatility is 1.2 which means a profit target of 120%. 5% range bound pattern gives us a profit target of 6% above the high of that range –> 0.5*1.2=0.6. Keep in mind that the profit target is based on the volatility of the asset. For stocks you can calculate the most recent beta values. For example, for most blue-chip stocks V values between 1.0 and 1.3 would represent a reasonable profit target. To identify these patterns we use the statistics as presented in the above table and define our strategy rules as follows:

  • A steep range bound of 5.5 times the ATR or more in 23 bars or less.
  • Flag breakout in 15 bars or less from the pole and sloping slightly down.
  • Flag depth no more than 2.5 times the ATR measured from the highest high to the lowest low.
  • Uptrend during last 70 bars leading to pole pattern formation.
  • Increased volatility during pattern formation.

In order to include as many as possible exit scenarios the strategy consists of five exit conditions:

  1. Profit target 1.2 times the pole.
  2. Stop loss activated if breakout below the support line.
  3. Trailing stop to preserve unrealized profits. Stop is triggered if difference between the highest value in the preceding five bar period and current bar was more than three times the 40 bar ATR.
  4. “No change” exit condition is triggered when the price breakout was less than four times the ATR. This stop is activated when the position is held for more than 70 bars.
  5. If no condition was triggered than the trade is terminated after 100 bars since trade entry.

Depending on the set of assets backtesting with optimized parameters should be included for stop loss, trailing stop and the no change exit condition. Here is the TradeStation code for the strategy:

The time frame tested was from November 30, 2009 until March 30, 2020. Other parameters we considered were commission per trade $5, Initial Capital $100,000, Interest Rate 2% (you wish), entire order is filled when trade occurs at limit price or better. Backtesting the strategy for ticker: AAPL with no optimization run we got following results:

DescriptionLong Trades
Total Net Profit$10,011.00
Gross Profit$25,365,00
Gross Loss($15,354.00)
Total Number of Trades246
Percent Profitable49.19%
Avg. Winning Trade$209.63
Avg. Losing Trade$40.70
Return on Account 722.82%
Max Equity Run-up$11,219.00
Avg. Bars in Winning Trades61.62
Avg. Bars in Losing Trades32.79
Largest Winner as % of Gross Profit4.86%

Despite not optimizing any of the parameters the test results show a profit factor of 1.65. The average time in winning trades was 3 days and 7 hours while losing trades had an average time in trades of 1 day and 14 hours. The average time between trades was 12 days and 19 hours. The largest winning trade was $1,233 and the largest losing trade was $733. We have reduced our market risk since our trading system was only in the market 16.04% of the time. Keep in mind that the formation of flags are much more likely in a bull market than in down trending markets. You should add another indicator to this strategy signaling the current market condition. Our test results show only 25 trades of the 246 in total were exited due to inactivity. Most failed trades occurred because of market noise and increased volatility. Stop loss parameters should therefore be optimized or adjusted on a constant basis depending on market volatility. Testing the strategy on AMZN gave us a profit factor of 1.6.

To find out on whether the system works when trading other assets we decided to test it on S&P 500 Index futures. Since we are trading an asset with a different volatility regime than an individual stock we decided to optimize the following parameters: MAXFLDUR (max flag duration), FLAGMIN (max avg. true range in lowest point in flag ) and PX (max pole duration). After 1980 optimization runs we get following test results:

DescriptionLong Trades
Total Net Profit$31,300.00
Gross Profit$126,837,00
Gross Loss($95,537.50)
Total Number of Trades580
Percent Profitable50.00%
Avg. Winning Trade$437.37
Avg. Losing Trade($339.99)
Return on Account 537.34%
Max Equity Run-up$37,750.00
Avg. Bars in Winning Trades61.47
Avg. Bars in Losing Trades31.51
Largest Winner as % of Gross Profit2.52%

Our optimized parameters [MAXFLDUR=12 FLAGMIN=3.25 PX=12] give us a profit factor of 1.33. The average time in winning trades was 23 hours and 23 minutes while losing trades had an average time in trades of 12 hours and 14 minutes. The average time between trades was 5 days and 18 hours. The largest winning trade was $4,087.50 and the largest losing trade was $2,312.50.

Keep in mind when backtesting a basket of stocks you want to use non correlated assets to reduce market risk. Most traders forget this when trading several different assets simultaneously. This inability to evaluate risk is part of the problem of bad portfolio design. Most portfolios are fundamentally flawed and prone to bigger losses (see Black Swan events) because they lack non correlated assets among other things.

If you like our article sign up here for more in-depth research [We publish trading strategies & research using R, Python and EasyLanguage]