Name
唐奇安通道骑势策略Donchian-Channel-Trend-Riding-Strategy
Author
ChaoZhang
Strategy Description
唐奇安通道骑势策略是一种趋势跟踪策略。它利用唐奇安通道来识别市场趋势,在趋势方向产生信号时进入场内,然后尽量捕捉趋势的全部行情。同时,它结合长周期均线来进行过滤,避免产生错误信号。止损设置在通道的下BAND,可以有效控制风险。
该策略主要基于唐奇安通道。唐奇安通道由上轨、下轨和中轨组成。上轨是过去n天的最高价,下轨是过去n天的最低价,中轨是上轨和下轨的平均值。当价格突破上轨时为做多信号,突破下轨时为做空信号。
策略首先计算长度为20天的唐奇安通道的上轨、下轨和中轨。然后判断价格是否突破通道。如果收盘价格突破200日均线 AND 收盘价格突破上轨,产生做多信号;如果收盘价格跌破200日均线 AND 收盘价格跌破下轨,产生做空信号。
进入做多仓位后,止损线设置为下轨;进入做空仓位后,止损线设置为上轨。
该策略具有以下优势:
-
能够有效识别市场趋势方向。唐奇安通道可以清楚识别出正在形成的趋势。
-
通过与长周期均线的组合,可以有效过滤误信号。长周期均线能确保只在大趋势方向才产生信号。
-
停损设置在通道边界,可以快速止损,有效控制风险。
-
策略逻辑简单清晰,容易理解和实现。
该策略也存在一定风险:
-
趋势反转风险。当市场趋势突然反转时,可能造成较大损失。
-
参数优化风险。唐奇安通道的参数如周期长度等需要不断测试优化,否则可能影响策略表现。
-
交易频率过高风险。唐奇安通道容易产生较多交易信号,可能导致过于频繁交易。
该策略可以从以下几个方面进行优化:
-
结合更多指标进行信号过滤。例如K线形态、波动率指标等,避免错误信号。
-
参数优化。对唐奇安通道的长度参数进行优化,找到最佳参数组合。
-
采用自适应止损。根据市场波动性和风险控制要求,采用自适应止损方法。
-
信号分类处理。对信号进行分类,采用不同的止损水平,区分强弱信号。
唐奇安通道骑势策略整体来说是一个较为简单实用的趋势跟踪策略。它能够有效识别市场趋势方向,最大程度捕捉趋势行情。同时结合长周期均线和通道边界止损来控制风险。该策略优化空间较大,在参数优化、信号过滤、止损方法等方面都可以进行改进,从而获得更好的策略表现。
||
The Donchian Channel Trend Riding Strategy is a trend following strategy. It uses Donchian Channel to identify market trend direction and enters the market when a trend signal is generated to capture as much of the trend movement as possible. Meanwhile, it incorporates long period moving average to filter out false signals. Stop loss is set at the lower band of the channel to effectively control risks.
The strategy is mainly based on the Donchian Channel. The Donchian Channel consists of an upper band, a lower band and a middle band. The upper band is the highest high over the past n days, the lower band is the lowest low over the past n days, and the middle band is the average of the upper and lower bands. A buy signal is generated when price breaks above the upper band. A sell signal is generated when price breaks below the lower band.
The strategy first calculates the 20-day Donchian Channel, including the upper band, lower band and middle band. It then checks if price breaks through the channel bands. If close price breaks above 200-day moving average AND close price breaks above upper band, a long signal is generated. If close price breaks below 200-day moving average AND close price breaks below lower band, a short signal is generated.
After entering long positions, stop loss is set at the lower band. After entering short positions, stop loss is set at the upper band.
The strategy has the following advantages:
-
It can effectively identify market trend directions. Donchian Channel makes trend identification clear.
-
Combining with long period moving average helps filtering out false signals effectively. The long period MA ensures that signals are only generated along the major trend direction.
-
Stop loss set at channel bands allows quick exit and effective risk control.
-
The strategy logic is simple and clear, easy to understand and implement.
The strategy also has some risks:
-
Trend reversal risk. Sudden trend reversal may cause huge loss.
-
Parameter optimization risk. Parameters of Donchian Channel need constant testing and optimization, otherwise it may affect strategy performance.
-
Excessive trading frequency risk. Donchian Channel tends to generate more frequent trading signals.
The strategy can be optimized in the following aspects:
-
Add more indicators for signal filtering, e.g. candlestick patterns, volatility indicators etc, to avoid false signals.
-
Parameter optimization. Optimize parameters like channel length to find the optimal parameter combination.
-
Adopt adaptive stop loss method according to market volatility and risk control needs.
-
Classify signals and adopt different stop loss levels to differentiate strong and weak signals.
In general, the Donchian Channel Trend Riding Strategy is a relatively simple and practical trend following strategy. It can effectively identify market trend directions and capture most of the trend movements. Meanwhile, long period moving average and channel bands stop loss help control risks. The strategy has large room for optimization in aspects like parameter tuning, signal filtering and stop loss methods etc, in order to achieve better performance.
[/trans]
Strategy Arguments
Argument | Default | Description |
---|---|---|
v_input_1 | 20 | length |
v_input_2 | 0 | Long Entry: Higher High |
v_input_3 | 0 | Short Entry: Lower Low |
Source (PineScript)
/*backtest
start: 2024-01-26 00:00:00
end: 2024-02-16 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pratyush_trades
//@version=4
strategy("Donchian Channel Strategy", overlay=true)
length = input(20)
longRule = input("Higher High", "Long Entry", options=["Higher High", "Basis"])
shortRule = input("Lower Low", "Short Entry", options=["Lower Low", "Basis"])
hh = highest(high, length)
ll = lowest(low, length)
up = plot(hh, 'Upper Band', color = color.green)
dw = plot(ll, 'Lower Band', color = color.red)
mid = (hh + ll) / 2
midPlot = plot(mid, 'Basis', color = color.orange)
fill(up, midPlot, color=color.green, transp = 95)
fill(dw, midPlot, color=color.red, transp = 95)
if (close>ema(close,200))
if (not na(close[length]))
strategy.entry("Long", strategy.long, stop=longRule=='Basis' ? mid : hh)
if (close<ema(close,200))
if (not na(close[length]))
strategy.entry("Short", strategy.short, stop=shortRule=='Basis' ? mid : ll)
if (strategy.position_size>0)
strategy.exit(id="Longs Exit",stop=ll)
if (strategy.position_size<0)
strategy.exit(id="Shorts Exit",stop=hh)
Detail
https://www.fmz.com/strategy/442870
Last Modified
2024-02-26 17:31:45