
The Dual SuperTrend strategy is a quantitative trading strategy that incorporates a dual SuperTrend channel system. It calculates true range volatility and constructs a two-band channel to monitor price breakthroughs, enabling trend following and reversal trading.
The Dual SuperTrend strategy derives from the SuperTrend indicator. SuperTrend consists of upper and lower bands to determine price trends and key support/resistance levels. The Dual SuperTrend builds two channels on top of it: the consolidating channel and the breaking channel.
The strategy firstly computes the true range and average true range. It then calculates the basic bands based on the length and multiplier parameters. Next, it constructs the breaking channel if the price breaks through the basic bands. The dual-channel system is thus established.
Under the dual-channel structure, trading signals are generated when the price crosses different channels:
The dual-channel monitoring enables both trend following and reversal capturing.
The Dual SuperTrend strategy with the dual-channel system has the following advantages:
The Dual SuperTrend strategy also has the following risks:
The risks can be mitigated by adjusting parameter range, adding filters, controlling position sizing, etc.
The Dual SuperTrend strategy can be optimized in the following aspects:
Further optimizations can improve Parameter Fitting and Walk Forward Analysis for more robust performance.
The Dual SuperTrend strategy leverages the dual-channel mechanism for trend following and reversal capturing. Stable trading strategies can be developed through parameter optimization, but limitations exist. Risk control addons are required. Overall, the Dual SuperTrend provides a solid framework for short-term quantitative trading strategies.
/*backtest
start: 2022-11-08 00:00:00
end: 2023-11-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Double Supertrend Strategy", overlay=true)
// Define your parameters
length = input(10, title="Length")
multiplier = input(3, title="Multiplier")
// Calculate the True Range and Average True Range
trueRange = max(high - low, max(abs(high - close[1]), abs(low - close[1])))
averageTrueRange = sma(trueRange, length)
// Calculate the basic upper and lower bands
basicUpperBand = hl2 + (multiplier * averageTrueRange)
basicLowerBand = hl2 - (multiplier * averageTrueRange)
// Calculate the final upper and lower bands
finalUpperBand = basicUpperBand
finalLowerBand = basicLowerBand
finalUpperBand := close[1] > finalUpperBand[1] ? max(basicUpperBand, finalUpperBand[1]) : basicUpperBand
finalLowerBand := close[1] < finalLowerBand[1] ? min(basicLowerBand, finalLowerBand[1]) : basicLowerBand
// Determine if we're currently in an uptrend or downtrend
uptrend = close > finalLowerBand[1]
downtrend = close < finalUpperBand[1]
// Plot the bands
plot(uptrend ? finalUpperBand : na, color=color.green, linewidth=2)
plot(downtrend ? finalLowerBand : na, color=color.red, linewidth=2)
// Define your conditions for entering and exiting trades
if (uptrend)
strategy.entry("Buy", strategy.long)
else if (downtrend)
strategy.entry("Sell", strategy.short)