Best SuperTrend AFL- Multiple ATR
The Best SuperTrend AFL is the one which combines different Buy and Sell trigger conditions to maximize profit potential and minimize possible losses.
Contents
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
vindix
Hi Admin,
I want a very simple AFL based on SuperTrend(un modified) along with SMA.
Buy = When last candle price close above Super trend (14,3) and last candle open Price above SMA (7 days)
Sell = When ever any down crossover of price on Supertrend (14,3).
Only Long no short position.
I want exploration afl.
I will be very very thankful if you help me.
Renu
i am getting error even after inserting my afl and then algo intraday afl
AlgoPro
@Renu, your AFL does not have Cover.
Write at the end of your AFL:
Short=Cover=0;
Renu
how should i add the code …bec i simply go long then stop hit and reverse..:)…
Renu
hi
i have added the code . and done the metioned parameter settings..pls guide me s how to proceed now . with . I get real time data from some software and in Nest trader. now how to built a interface with nest trader and amibroker for auto trade
AlgoPro
@Renu, you do not have Cover defined in your AFL… which means that the AFL does NOT stop and reverse. You may do that manually by looking at signals, but the AFL does NOT gives short/cover signals.
You can do automated trading through Nest only by using Nest Plus API. So go through articles related to Nest Plus API by using the search function on top of page.
Dhawalsh
Hi Saurabh,
This strategy seems very nice but when looking at the chart i realized that at certain times it makes you exit the trade too conservatively.
This strategy makes you exit the trade if small multiplier hits its stop loss. But it does not enter again when both ATR shows buy again.
Please refer to image attached which will explain my requirement.
Can you please do the correction and upload the AFL.
Avi
download does not work