ドンチアン運河からの脱出戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-29 11:51:08
タグ:

img

概要

ドンチアン・チャネル・ブレイクアウト戦略は,トレンドフォロー戦略である.特定の期間における最高価格と最低価格を計算して価格チャネルを形成し,チャネルの境界を買い売り信号として使用する.価格が上層線を突破すると短く,価格が下層線を突破すると長くなります.この戦略は,非常に不安定な仮想通貨取引に適しています.

戦略の論理

この戦略は,価格動向を決定し,エントリー&エグジットポイントを計算するためにドンキアン・チャネル指標を使用する.ドンキアン・チャネルは,上列,下列,中列で構成される.上列は特定の期間で最も高い価格,下列は最低価格,中列は平均価格である.

エントリーとエグジット・ピリオドの長さは独立して設定できます. 価格が下のレールを上向きに突破すると,それは長い. 上向きのレールを下向きに突破すると,それは短くなります. エグジットポイントは価格が再び対応するレールを触るときです. 中間レールはストロストラインとしても使用できます.

また,この戦略は,利益を引き出すポイントも設定している.ロングポジションの利益を引き出す価格は,入場価格を (1 + 利益を引き出す割合) で掛け,ショートポジションでは逆である.この機能を有効にすることで利益が固定され,損失が拡大するのを防ぐ.

概要すると,この戦略は,トレンドを判断する一方で,ストップを設定し利益を得るために十分な余地を提供します.これは,暗号通貨のような非常に不安定な資産に特に適しています.

利点分析

この戦略の利点は以下の通りです.

  1. 明確な信号論理と シンプルで信頼性の高い信号生成
  2. ドンチアン・チャネル指標は価格変動に敏感ではなく,傾向を把握するのに役立ちます.
  3. 異なる資産と時間枠に合わせて チャンネルパラメータをカスタマイズできます
  4. ストップ・ロスト/テイク・プロフィート機能が組み込まれているので,リスクは効果的にコントロールできます.
  5. 仮想通貨のような不安定な資産の利益の可能性が高い

リスク分析

この戦略のリスクは以下のとおりです.

  1. ストップ・ロスのにもかかわらず 巨大な価格変動によるリスクを完全に回避できない.
  2. パラメータの設定が正しくない場合,過剰な取引が起こり,コストが上昇する可能性があります.
  3. 価格変動に敏感でないので 取引機会を逃すかもしれません

上記のリスクを軽減するために:

  1. ポジションのサイズを適切に調整し,資産を分散して全体的なリスクをコントロールする.
  2. 最適な組み合わせを見つけるために パラメータを最適化します
  3. 信号の信頼性を決定するための追加指標を組み込む.

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

この戦略は,次の次元でさらに最適化できます.

  1. 最適値を見つけるためにより多くのパラメータの組み合わせをテストし最適化します.主要なパラメータには,チャネル期間,利益率,ロング/ショート等が含まれます.
  2. 機械学習モデルを組み込み,最適パラメータを自動的に識別します.例えば,強化学習を使用します.
  3. 移動平均値とボリュームなどの他の指標を組み合わせて 傾向と信号の信頼性を決定します
  4. より高度なストップ損失戦略を策定する.例えば,ストップ損失を後押しする,チェンデリア出口など,リスクをより良く制御する.
  5. 戦略をさらに多くの資産クラスに広げて 最適なものを探します

結論

結論として,ドンキアンチャネルブレイクアウト戦略は,トレンド取引に明確な信号と制御可能なリスクを提供します.特に大きな利益の可能性を持つ暗号通貨のような不安定な資産に適しています.また,パラメータをさらに最適化し,将来の強化のための道である他の指標を組み込む可能性もあります.継続的な革新により,この戦略は暗号通貨のための重要なアルゴリズム取引戦略になる可能性があります.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 4h
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/
// © algotradingcc
// Strategy testing and optimisation for free trading bot 

//@version=4
strategy("Donchian Channel Strategy [for free bot]", overlay=true )

//Long optopns
buyPeriodEnter = input(10, "Channel Period for Long enter position")
buyPeriodExit = input(10, "Channel Period for Long exit position")
isMiddleBuy = input(true, "Is exit on Base Line? If 'no' - exit on bottom line")
takeProfitBuy = input(2.5, "Take Profit (%) for Long position")
isBuy = input(true, "Allow Long?")

//Short Options
sellPeriodEnter = input(20, "Channel Period for Short enter position")
sellPeriodExit = input(20, "Channel Period for Short exit position")
isMiddleSell = input(true, "Is exit on Base Line? If 'no' - exit on upper line")
takeProfitSell = input(2.5, "Take Profit (%) for Short position")
isSell = input(true, "Allow Short?")

// Test Start
startYear = input(2005, "Test Start Year")
startMonth = input(1, "Test Start Month")
startDay = input(1, "Test Start Day")
startTest = timestamp(startYear,startMonth,startDay,0,0)

//Test End
endYear = input(2050, "Test End Year")
endMonth = input(12, "Test End Month")
endDay = input(30, "Test End Day")
endTest = timestamp(endYear,endMonth,endDay,23,59)

timeRange = time > startTest and time < endTest ? true : false

// Long&Short Levels
BuyEnter = highest(buyPeriodEnter)
BuyExit = isMiddleBuy ? ((highest(buyPeriodExit) + lowest(buyPeriodExit)) / 2): lowest(buyPeriodExit)

SellEnter = lowest(sellPeriodEnter)
SellExit = isMiddleSell ? ((highest(sellPeriodExit) + lowest(sellPeriodExit)) / 2): highest(sellPeriodExit)

// Plot Data
plot(BuyEnter, style=plot.style_line, linewidth=2, color=color.blue, title="Buy Enter")
plot(BuyExit, style=plot.style_line, linewidth=1, color=color.blue, title="Buy Exit", transp=50)
plot(SellEnter, style=plot.style_line, linewidth=2, color=color.red, title="Sell Enter")
plot(SellExit, style=plot.style_line, linewidth=1, color=color.red, title="Sell Exit", transp=50)

// Calc Take Profits
TakeProfitBuy = 0.0
TakeProfitSell = 0.0
if strategy.position_size > 0
    TakeProfitBuy := strategy.position_avg_price*(1 + takeProfitBuy/100)
    
if strategy.position_size < 0
    TakeProfitSell := strategy.position_avg_price*(1 - takeProfitSell/100)

// Long Position    
if isBuy and timeRange
    strategy.entry("Long", strategy.long, stop = BuyEnter, when = strategy.position_size == 0) 
    
strategy.exit("Long Exit", "Long", stop=BuyExit, limit = TakeProfitBuy, when = strategy.position_size > 0)

// Short Position
if isSell and timeRange
    strategy.entry("Short", strategy.short, stop = SellEnter, when = strategy.position_size == 0) 
    
strategy.exit("Short Exit", "Short", stop=SellExit, limit = TakeProfitSell, when = strategy.position_size < 0)

// Close & Cancel when over End of the Test
if time > endTest
    strategy.close_all()
    strategy.cancel_all()


もっと