Range Breakout AFL Strategy - AlgoJi

Step 1: The Trading Idea

Buy or Sell when prices break the range of previous n periods

Step 2: Selecting Indicators for Trading System

This strategy uses only price action and no indicators. The range for last n periods is calculated by taking the highest high and lowest low value of last n periods. This range is also called Donchian Channels.

Such trading strategy was suggested by trader Richard Donchian. Richard suggested to use the strategy on daily timeframe for a range of last 20 days. In our testing on 15-minute time frame, we use the 50 period window to avoid false signals.

These are also called volatility bands because the expanding/contracting channels indicate the market volatility. The trading rules for this strategy are similar to the ATR Bands Strategy and Bollinger Bands Strategy.

Step 3: Defining Clear Rules for Range Breakout AFL Strategy

Buy: When price cross above the 50 period range

Sell:  When prices cross below the 50 period range

Range Breakout AFL

Please note that this is a signal-to-signal, or a stop-and-reverse strategy.

Step 4: AFL Coding Guide

The AFL code is pretty straightforward. Care is taken to define Buy, Sell, Short and Cover properly. The signal cycles are checked in default code to ensure proper signal occurrence.

Step 5: The Backtest

The strategy is remarkably profitable in Bank Nifty current month futures. It generates a profit of 7439 points, or Rs. 5,57,925/- over two years on one lot (75 shares). The winner% is 43.36, which is a also good for a trend following stop-and-reverse strategy.

Related Article: Basics in Strategy Backtesting

  • Scrip: Bank Nifty current month futures, 15-minute
  • All trades executed at Close price of the bar on which signal is triggered
  • Brokerage: 0.01% of Trade Value
  • Data History: 01-01-2014 to 31-12-2015 (two years)
  • Strategy Optimization: None

Step 6: Further Improvement

We leave it to the readers to suggest any improvement in Step 2 and Step 3 which can increase the profitability. We can introduce custom stoploss as well as profit targets to further maximize the profitability.

Download here Range Breakout AFL Strategy

Click here to download the editable Amibroker Range Breakout AFL Strategy

Click here to learn more about Donchian Channels on Traders Planet