双唐奇安通道突破策略是一种基于唐奇安通道的量化交易策略。该策略利用快速唐奇安通道和慢速唐奇安通道的组合,实现低风险高收益的突破交易。当价格突破慢速通道时入场做多/做空,当价格重新突破快速通道时离场止损或止盈。
该策略主要基于两个唐奇安通道,包括一个周期较长的慢速唐奇安通道和一个周期较短的快速唐奇安通道。
慢速唐奇安通道的周期较长,可以有效滤除市场噪音,其突破信号具有较高的可靠性。当价格突破慢速通道上轨时,做多入场;当价格跌破慢速通道下轨时,做空入场。
快速唐奇安通道的周期较短,可以快速响应短期价格变动。当价格重新突破这个通道时,说明趋势发生转折,需要立即止损或止盈离场。
此外,还设置了波动率条件作为策略的入场过滤器。只有当价格波动超过事先设置的阈值百分比时,才会触发入场。这可以避免在横盘整理中频繁出入场。
可以通过优化参数,合理设置止损点,关注重大事件等措施来减少这些风险。
双唐奇安通道突破策略整体而言是一种相对稳定可靠的趋势追踪策略。它同时兼具趋势捕捉和风险控制的优点,适合作为多种股票交易策略的基础模块。通过参数优化和规则完善,可以进一步提升该策略的效果。
/*backtest start: 2024-01-04 00:00:00 end: 2024-02-03 00:00:00 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) slowLen = input.int(50, title="Slow Donchian") fastLen = input.int(30, title="Fast Donchian") volatility = input.int(3, title="Volatility (%)") longProfitPerc = input.float(2, title="Long TP1 (%)", minval=0.0, step=0.1) * 0.01 shortProfitPerc = input.float(2, title="Short TP1 (%)", minval=0.0, step=0.1) * 0.01 TP1Yuzde =input.int(50, title = "TP1 Position Amount (%)") ubSlow = ta.highest(close, slowLen)[1] lbSlow = ta.lowest(close, slowLen)[1] ubFast = ta.highest(close, fastLen)[1] lbFast = ta.lowest(close, fastLen)[1] 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") fark = (ubSlow - lbSlow) / lbSlow * 100 longExitPrice = strategy.position_avg_price * (1 + longProfitPerc) shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc) longCondition = ta.crossover(close, ubSlow) and fark > volatility if (longCondition) strategy.entry("Long", strategy.long) shortCondition = ta.crossunder(close, lbSlow) and fark > volatility if (shortCondition) strategy.entry("Short", strategy.short) if strategy.position_size > 0 and ta.crossunder(close, lbFast) strategy.close("Long", "Close All") if strategy.position_size < 0 and ta.crossover(close, ubFast) strategy.close("Short", "Close All") // Take Profit if strategy.position_size > 0 strategy.exit("TP1", "Long", qty_percent = TP1Yuzde, limit = longExitPrice) if strategy.position_size < 0 strategy.exit("TP1", "Short", qty_percent = TP1Yuzde, limit = shortExitPrice)