Step 1: The Trading Idea
When same indicator is used with different parameters (usually in a multiple of 2 or 3), it reflects the price behavior in different time frames. This is because by increasing the period/factor, the indicator is able to capture more price data.
Step 2: Selecting Indicators- Multiple SuperTrend
The default Supertrend indicator is a great tool to clearly identify trend. It is calculated by offsetting Average True Range (ATR) to create upper and lower band around prices. The direction of trend is decided by further using a stop-and-reverse trailing stop loss and then resetting the upper/lower bands when the TSL is breached.
We can further improvise Supertrend strategy by using two different SuperTrend indicators for generating trade signals. A Buy Entry trade is generated when both supertrend indicators are in uptrend. However, the Buy trade will be exited when either of the Supertrend goes in downtrend. This helps in exiting fast from the market when the trend is not intact.
Chart Time Frame: 15 minutes
SuperTrend 1 (ST1): ATR Factor = 3, ATR Periods = 10. SuperTrend 2 (ST2): ATR Factor = 6, ATR Periods = 20.
Step 3: Defining Clear Strategy Rules
Buy: when both ST1 and ST2 indicate uptrend (both generate Buy signal at same time)
Sell: when either of ST1 or ST2 indicates downtrend
Step 4: AFL Coding Guide (Non-repainting)
For coding, we have simply duplicated the two ST indicators using different parameters. However, a very common problem is supertrend is that either that the signal is forward looking- that is, signal on current candle will be generated after next candle starts. As such, signal is never generated on last candle on the chart which makes it unfit for auto trading in some software.
To get rid of this problem, signals are shifted to the Open of a candle when it is confirmed. In backtest also, the trade prices are selected as Open of candle. For live trading also, the user should immediately trigger order when signal is generated.
Step 5: Backtesting for Best SuperTrend AFL
The strategy increase profits by almost 70% by using two ATR values. When tested with both supertrend for same ATR Factor= 3, the strategy gives a profit 4343 points. But when two different ATR factors are used- 3 and 5- the profit increased to 7404. For one lot (75), the profit translates to Rs. 5,55,300. The ATR Period = 10 has been used in both case for testing purpose.
Related Article: Basics in Strategy Backtesting
- Scrip: Bank Nifty current month futures, 15-minute
- All trades executed at Open price of the bar on which signal is triggered
- Brokerage: 0.01% of Trade Value
- Time Frame: 15 minute
- 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. The developments for best SuperTrend AFL will only be limited by our own market knowledge.
Download Amibroker AFL Strategy
Click here to download the editable Amibroker AFL Strategy