The Dual Donchian Channel Breakout Strategy is a breakout trading strategy based on Donchian Channels. It uses fast and slow Donchian Channels to construct long and short trading signals. When the price breaks through the slow channel, open long or short positions. When the price breaks back through the fast channel, close positions. The strategy also sets take profit and stop loss conditions.
The Dual Donchian Channel Breakout Strategy is based on two parameters: Slow Donchian Channel Period and Fast Donchian Channel Period. The strategy first calculates the upper and lower bands of the two Donchian Channels.
The long entry signal is a breakout above the upper band with volatility greater than the threshold. The short entry signal is a breakdown below the lower band with volatility greater than the threshold.
The long stop loss exit signal is a breakdown below the lower band. The short stop loss exit signal is a breakout above the upper band.
The strategy also sets take profit exit conditions. The default take profit ratio is 2%, that is, take profit half position when price movement reaches 2%.
The Dual Donchian Channel Breakout Strategy has the following advantages:
The dual channel design can capture trend signals from both longer and shorter timeframes, allowing more accurate entries.
The volatility condition avoids frequent trading in range-bound markets.
Comprehensive take profit and stop loss settings lock in partial profits and reduce losses.
Simple and clear strategy logic, easy to understand and implement.
Customizable parameters suit different products and trading preferences.
The Dual Donchian Channel Breakout Strategy also has some risks:
The dual channel design is sensitive and can generate false signals. Wider channels or adjusted volatility parameters may reduce false signals.
In volatile markets, stop loss may trigger too frequently. Consider setting a limit on number of trades or widening stop loss range.
Fixed percentage take profit fails to maximize profits. Consider dynamic or manual intervention for optimal take profit pricing.
Real trading performance may differ from backtest expectations. Requires thorough validation and parameter adjustments if needed.
The Dual Donchian Channel Breakout Strategy can be optimized in several aspects:
Test more period combinations to find optimal parameters.
Try different volatility measures like ATR to find the most stable metric.
Set a limit on number of entries to avoid losses at end of trends.
Try dynamic take profit for higher single trade profit.
Incorporate other indicators to filter entries and improve accuracy, e.g. volume.
Optimize money management models like fixed fractional position sizing for better risk control.
In conclusion, the Dual Donchian Channel Breakout Strategy is an excellent trend following strategy. It combines both trend identification and reversal protection capabilities. With parameter optimization and rule refinement, it can be profitable across most products and market conditions. The strategy is simple and practical, worth learning and applying for quantitative traders.
/*backtest start: 2024-01-01 00:00:00 end: 2024-01-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © omererkan //@version=5 strategy(title="Double Donchian Channel Breakout", overlay=true, initial_capital = 1000, commission_value = 0.05, default_qty_value = 100, default_qty_type = strategy.percent_of_equity) // Donchian Channels slowLen = input.int(50, title="Slow Donchian", group = "Conditions") fastLen = input.int(30, title="Fast Donchian", group = "Conditions") // Volatility Calculated as a percentage volatility = input.int(3, title="Volatility (%)", group = "Conditions") // Long positions long = input.bool(true, "Long Position On/Off", group = "Strategy") longProfitPerc = input.float(2, title="Long TP1 (%)", group = "Strategy", minval=0.0, step=0.1) * 0.01 // Short positions short = input.bool(true, "Short Position On/Off", group = "Strategy") shortProfitPerc = input.float(2, title="Short TP1 (%)", group = "Strategy", minval=0.0, step=0.1) * 0.01 // First take profit point for positions TP1Yuzde =input.int(50, title = "TP1 Position Amount (%)", group = "Strategy") // Slow Donchian Calculated ubSlow = ta.highest(high, slowLen)[1] lbSlow = ta.lowest(low, slowLen)[1] // Fast Donchian Calculated ubFast = ta.highest(high, fastLen)[1] lbFast = ta.lowest(low, fastLen)[1] // Plot Donchian Channel for entries plot(ubSlow, color=color.green, linewidth=2, title="Slow DoCh - Upperband") plot(lbSlow, color=color.green, linewidth=2, title="Slow DoCh - Lowerband") plot(ubFast, color=color.blue, linewidth=2, title="Fast DoCh - Upperband") plot(lbFast, color=color.blue, linewidth=2, title="Fast DoCh - Lowerband") // This calculation, the strategy does not open position in the horizontal market. fark = (ubSlow - lbSlow) / lbSlow * 100 // Take profit levels longExitPrice = strategy.position_avg_price * (1 + longProfitPerc) shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc) // Code long trading conditions longCondition = ta.crossover(close, ubSlow) and fark > volatility if longCondition and long == true strategy.entry("Long", strategy.long) // Code short trading conditions shortCondition = ta.crossunder(close, lbSlow) and fark > volatility if shortCondition and short == true strategy.entry("Short", strategy.short) // Determine long trading conditions if strategy.position_size > 0 and ta.crossunder(close, lbFast) strategy.close_all("Close All") // Determine short trading conditions if strategy.position_size < 0 and ta.crossover(close, ubFast) strategy.close_all("Close All") // Take Profit Long if strategy.position_size > 0 strategy.exit("TP1", "Long", qty_percent = TP1Yuzde, limit = longExitPrice) // Take Profit Short if strategy.position_size < 0 strategy.exit("TP1", "Short", qty_percent = TP1Yuzde, limit = shortExitPrice)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6