ドンチアン・チャネルに基づく亀貿易戦略

作者: リン・ハーンチャオチャン, 日付: 2023-12-25 10:57:52
タグ:

img

概要

この戦略の名称は"ドンチアンチャネルに基づくタートル・トレーディング戦略"である.有名な"タートル・トレーディング・ルール"から主要なアイデアを借り,市場動向を決定するためにドンチアンチャネルを使用し,フィルタリングのための移動平均と組み合わせ,比較的単純なトレンドフォロー戦略を実現する.

戦略原則

この戦略の判断の主な指標はドンチアンチャンネルである.ドンチアンチャンネルは,N日間の最高値と最低値の変動範囲で構成される.価格がチャネルの上部レールを破ると,それは長い信号であり,チャネル下部レールを破ると,それは短い信号である.この戦略は信号を発行するために高速ドンチアンチャンネル (10日),損失を止めるために遅いドンチアンチャンネル (20日) を使用する.

さらに,この戦略はシグナルをフィルターするために2つの移動平均線 (50日線と125日線) を導入する.高速移動平均線がスロームービング平均線を越えたときのみ,ロングポジションが取引される.高速移動平均線がスロームービング平均線を下回ったときのみ,ショートポジションが取引される.これはいくつかの誤った信号を効果的にフィルターすることができます.

この戦略の開設条件は:価格がドンチアンチャンネル上部線を突破し,高速移動平均線がスロームービング平均線を越える.両方の条件が満たされると,ロングポジションが開かれる.価格がドンチアンチャンネル下部線を突破し,高速移動平均線がスロームービング平均線を下部線を突破し,その後ショートポジションを開く.閉じる条件は価格が対照的なスロードンチアンチャンネル境界に触るとである.

利点分析

この戦略の利点は次のとおりです.

  1. ドンチアン・チャネルを使用してトレンド方向を決定すると,バックテスト効果により大きなトレンドを成功裏に把握できます.

  2. 移動平均値のフィルターを追加することで,いくつかの誤った信号をフィルターで排除し,損失を回避できます.

  3. 急速で遅いドンチェインチャネルと移動平均の組み合わせにより,取引頻度とストップロスの精度はバランスできます.

  4. リスクは,単一の損失を制御するストップ損失メカニズムによって適切に制御されます.

リスク分析

この戦略のリスクは

  1. ショック市場では 小規模な負けるオーダーが増える可能性があります

  2. トレンド逆転が起こると,移動平均値のフィルタリングは開設コストを増加させる.

  3. 急激な市場では,ストップ・ロスは追われるかもしれません.

対策と解決策

  1. 適切なパラメータを調整して ドンチアンサイクルを短縮し 移動平均サイクルを短縮して 異なる市場に対応します

  2. 主要なトレンドに対する判断を高め 主要なトレンドに対するポジションを構築しないようにする.

オプティマイゼーションの方向性

戦略は以下の側面で最適化できます.

  1. 突破力の強さを高める.例えば,ボリュームを導入し,ボリュームが拡大するときにのみポジションを開く.

  2. 熱いエリアの判断を高める. ポジションを開くときに熱いエリアを避けるためにサポート,圧力,バンド,パターンなどと組み合わせる.

  3. ストップ・ロスの戦略を最適化する.ストップ・ロスの追跡,波動性ストップ・ロスの追跡,タイムストップ・ロスの導入などによりストップ・ロスのスマート化.

概要

一般的には,この戦略は非常に典型的でシンプルなトレンドフォロー戦略である.ドンチアンチャネルを通じて方向を決定し,移動平均値を通じてシグナルをフィルタリングすることによって良いバックテスト結果を実現する.この戦略は,大きなトレンドを追求する投資家にとって適しており,リスク制御が良好で,実際の取引で実装が容易である.いくつかのパラメータとルールを最適化することで,勝利率と収益性はさらに改善することができる.


/*backtest
start: 2023-11-24 00:00:00
end: 2023-12-24 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
// Coded by Vladkos
strategy("Donchian strategy with filter", overlay=true,default_qty_type = strategy.percent_of_equity, default_qty_value = 4,pyramiding=5)

fromyear = input(2017, defval = 2018, minval = 1800, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(21, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
term = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59))
ATR=input(20,minval=1)
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
needstoploss= input(true,defval=true,title="Stop LOSS")
///////////ATR
tra=atr(ATR)


////////////Переменные
Donchian_slow=input(20,minval=1)
Donchian_fast=input(10,minval=1)
Slow_EMA=input(125,minval=1)
Fast_EMA=input(50,minval=1)

/////////// Медленный Дончан
lower = lowest(Donchian_slow)
upper = highest(Donchian_slow)
basis = avg(upper, lower)
plot(lower,color=blue)
plot(upper,color=blue)

/////////// быстрый Дончан
lowerF = lowest(Donchian_fast)
upperF = highest(Donchian_fast)
basisF = avg(upperF, lowerF)
plot(lowerF,color=red)
plot(upperF,color=red)

////////// Скользящие средние
ema_S=ema(close,Slow_EMA)
ema_F=ema(close,Fast_EMA)
plot(ema_S,color=red)
plot(ema_F,color=green)

///////// Условия сделок
long_condition= close>=upper[1] and ema_F>ema_S  
long_exit= close<lowerF[1]

short_condition=close<=lower[1] and ema_F<ema_S
short_exit=close>upperF[1]

////////// Отправка ордеров
strategy.entry("Long",strategy.long,when=long_condition and term and needlong==true)
strategy.exit("stop loss","Long",stop=strategy.position_avg_price-(tra*2),when= (needstoploss==true))
strategy.close("Long",when=long_exit and (time < timestamp(toyear, tomonth, today, 23, 59)))
    
strategy.entry("Short",strategy.short,when=short_condition and term and (needshort==true))
strategy.exit("stoploss","Short",stop=strategy.position_avg_price+(tra*2),when= (needstoploss==true))
strategy.close("Short",when=short_exit and (time < timestamp(toyear, tomonth, today, 23, 59)))

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()






もっと