Range Breakout AFL Strategy
Contents
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
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
Jit R
I would like to do the back testing of this breakout system. Suppose the 50 day range is 100. I want to buy only if it breaks out after 100 say, 100.01.
If the price never goes above 100, my limit order would not be executed.
My take profit is 101, SL is 99.
So how do I back test this scenario?
Thanks.
Jit R
I mean to back test in Amibroker system.
shrikant thombre
Hi
I am a working professional and want to have a code wherein i can auto place buy and sell order simultaneously at exactly 9:15 in the morning.
The position should squareoff automatically at end of the day.
Strategy name is “Previous day range breakout”
Buy above yesterdays high and Sell below yesterdays low.
If gapup then Sell below yesterdays high
If gapdown then Buy above yesterdays low.
Can someone plz share me the python code and the implementation steps for the same.
Thanks in advance for your help.
darshan
Hi shrikant thombre,
I am darshan, Currently in USA on short trip.
I can help you with the Ruby code if your still looking for some one for the implementation for your breakout strategy, let me know
My number : +91 9945889945
Thans
Darshan
Love_spiller
In comment section I always see people asking very basic questions which actually is prequisite for trading . Like how to backtest how to use amibroker or similar platforms .
My suggestion would be to kindly devote some time to learn trading and softwares, it is like any other business or job where you need to put in efforts to earn revenue and trading can never be taken as something you do in lunch break in office. If it was that easy we would have a lot of algo millionaires
Secondly buy these trading softwares because a lot of people put in lot of efforts to develop them and it comes will a lot learning materials self explanatory of each feature or queries you might have.
Happy trading happy minting . Cheers
magan
when try to download afl getting page not found 404 error kindly please update