The Supertrend BarUpDn Fusion strategy is a strategy that fuses the Supertrend indicator and the BarUpDn indicator. The strategy will go long if either the Supertrend or BarUpDn indicator gives a long signal, and will go short if either indicator gives a short signal.
The strategy mainly utilizes two indicators:
Supertrend Indicator: This indicator determines the trend direction based on Average True Range and a factor. It gives long signals when price is in an uptrend channel and short signals when price is in a downtrend channel.
BarUpDn Indicator: This indicator judges if the current bar is a bullish bar (close higher than open) or bearish bar (open higher than close). It returns 1 for bullish bars and -1 for bearish bars.
The main logic of the strategy is:
Go long when Supertrend is long and BarUpDn is bullish.
Go short when Supertrend is short and BarUpDn is bearish.
Close positions timely when Supertrend changes direction.
Through this fusion, the strategy can utilize both the trend judging capability of Supertrend and the short-term judging capability of BarUpDn to achieve better entry timing.
The main advantages of this strategy are:
Improved accuracy by fusing multiple indicators. Utilizing both the trend judging of Supertrend and the short-term judging of BarUpDn can improve entry timing accuracy.
Timely stop loss. Quickly cutting losses when the main indicator Supertrend changes direction can avoid enlarging losses.
Simple and easy to use. The strategy only uses a combination of two common indicators, making it very simple and easy to use.
Strong adaptability. Supertrend itself has adjustable parameters to adapt to different products and timeframes.
There are also some risks with this strategy:
Incorrect judging from improper fusion may cause misjudging. Timely stop loss when indicators give inconsistent signals.
Improper parameter tuning affects performance. Supertrend’s ATR Length and Factor need to be adjusted for different products.
Short-term reversals may cause minor losses. Small losses may occur during short-term price reversals before Supertrend turns direction.
The strategy can be optimized from the following aspects:
Add stop loss strategies like moving stop loss, time stop loss, breakout stop loss etc. to further control risks.
Optimize parameters of Supertrend to find the best parameter combinations for different products and timeframes, e.g. via machine learning.
Add more indicator fusion to build a voting mechanism and improve judging stability.
Incorporate more market factors like volume change, spread change etc. to judge signal reliability and filter misleading signals.
The Supertrend BarUpDn Fusion Strategy fuses trend judging and short-term judging by combining simple indicators, improving entry timing accuracy while keeping simplicity and ease of use. The strategy can be further enhanced by parameter optimization, stop loss optimization, indicator voting etc.
/*backtest start: 2023-12-01 00:00:00 end: 2023-12-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Supertrend and BarUpDn Indicator Fusion", overlay=true) // Supertrend indicator atrLength = input(10, title="ATR Length") factor = input(3.0, title="Factor") [supertrend, direction] = ta.supertrend(factor, atrLength) lastBar = 0 // BarUpDn indicator barUpDn = close > open and open > close[1] ? 1 : close < open and open < close[1] ? -1 : 0 if (barUpDn == 1) lastBar := 1 else if barUpDn == -1 lastBar := -1 // Determine long or short position longCondition = (direction > 0 and barUpDn > 0) or (direction > 0 and lastBar == 1) shortCondition = (direction < 0 and barUpDn < 0) or (direction < 0 and lastBar == -1) // Enter long or short position if (longCondition) strategy.entry("Long", strategy.long) lastBar := 1 else if (shortCondition) strategy.entry("Short", strategy.short) lastBar := -1 if (direction < 0 and barUpDn > 0) strategy.entry("Long", strategy.long) // Exit long or short position if (direction > 0 and barUpDn < 0) strategy.entry("Short", strategy.short) // Exit long or short position // if (direction < 0 and barUpDn > 0 or direction > 0 and barUpDn < 0) // strategy.close_all()