二重追跡の亀取引戦略

作者: リン・ハーンチャオチャン開催日:2023年12月20日 13:37:31
タグ:

img

概要

この戦略は,損失を制限するために亀取引規則に基づく2つのストップ損失ポイントを活用し,市場のノイズをフィルタリングし,より顕著なトレンドを入力するために異なるパラメータを設定します.

戦略の論理

この戦略は,エントリーシグナルを決定するために主に2つの追跡ストップ損失ポイント,long_1とlong_2に依存している.Long_1は長期トレンドを追跡し,long_2は短期トレンドを追跡する.Profit1とprofit2はストップ損失ポイントとして機能する.

価格がlong_1を下回る場合,市場は長期上昇傾向にある.価格がlong_2を下回る場合,それは短期的なプルバックを示し,ロングに行く良いエントリー機会を提供します.価格がlong_1を下回る場合は,長期的トレンドが確認されていません.しかし価格がlong_2を下回る場合は,短期的なブランスを示し,ロングポジションも取ることができます.

入力後,2つの追跡ストップ損失 (ストップロス1) とストップロス (2) が設定され,最大値を取るために利益1と利益2と比較されます.

利点分析

  • ダブルトラッキングストップ・ロスはリスクと利益のロックを効果的に制御します
  • 長期指標と短期指標を組み合わせることで,ノイズをフィルタリングし,より顕著な傾向がわかります.
  • 戦略の保守性を調整する柔軟性 パラメータ調整

リスク分析

  • 戦略は保守的で,いくつかの機会を逃す可能性があります
  • 誤ったストップ損失設定は,早速終了する可能性があります.
  • 取引が減るので 取引が損なわれるだけで 大きな影響が出るかもしれません

ストップ・ロスのアルゴリズムを最適化して適応性調整を行う.

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

  • ロングとプロフィートの最適なパラメータの組み合わせを見つける
  • 不必要なストップを減らすため,ジグザグまたはシャドウストップ損失を実験する
  • より強い確立されたトレンドを検出するためにより多くのエントリフィルターを追加します
  • 本物のブレイクを捕まえるためにボリューム指標を組み込む

概要

これは,安定した成長を求める投資家に適した全体的な保守的な戦略である.パラメータを調整し,ストップ損失アルゴリズムを最適化することで,攻撃性が増加することができる.市場のノイズをフィルタリングするメカニズムを追加することは,さらなる最適化のための方向性でもある.


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

//@version=4
strategy("Turtle Project",overlay= true)
//-----------------------------------------------------------
entry_1 =  input(55) 
profit_1 =  input(20)             

long_1 = float(na)                                                             
long_1:= if high[entry_1] >= highest(high,entry_1)                   
    high[entry_1]                                                            
else                                                                              
    long_1[1]                                                                   


profit1 = float(na)                                                            
profit1:= if low[profit_1] <= lowest(low,profit_1)                   
    low[profit_1]                                                            
else                                                                            
    profit1[1]                      
//-----------------------------------------------------------
entry_2 =  input(20) 
profit_2 =  input(10)             

long_2 = float(na)                                                             
long_2:= if high[entry_2] >= highest(high,entry_2)                   
    high[entry_2]                                                            
else                                                                              
    long_2[1]                                                                   


profit2 = float(na)                                                            
profit2:= if low[profit_2] <= lowest(low,profit_2)                   
    low[profit_2]                                                            
else                                                                           
    profit2[1]                      
//------------------------------------------------------------
stoploss_1= lowest(low,1) < long_1 and highest(high,1) > long_1
stoploss_2= lowest(low,1) < long_2 and highest(high,1) > long_2 

stop_1 = input(1)/100
stop_2 = input(2)/100

plotchar(stoploss_1, "high1", "▲",location.top,color=color.red )
plotchar(stoploss_2, "high2", "▲",location.top,color=color.blue)


//------------------------------------------------------------
if strategy.position_size == 0
    if low < long_1
        if high < long_1 
            strategy.entry("longlong_4",strategy.long, stop=long_1)

if strategy.position_size == 0    
    if low > long_1
        if high < long_2 
            strategy.entry("longlong_3",strategy.long, stop=long_2)

stoploss1 = float(na)
stoploss1:= stoploss_1 ? strategy.position_avg_price * (1 - stop_1) : stoploss1[1]
stoploss__1 = max(stoploss1,profit1)

if high > long_1 and strategy.position_size > 0
    strategy.exit("exit_1 ","longlong_4",stop=stoploss__1)

stoploss2 = float(na)
stoploss2:= stoploss_2 ? strategy.position_avg_price * (1 - stop_2) : stoploss2[1]
stoploss__2 = max(stoploss2,profit2)

if high > long_2 and strategy.position_size > 0
    strategy.exit("exit_2 ","longlong_3",stop=stoploss__2)
//--------------------------------------------------------------
plot(long_1,color=color.red ,linewidth=3)
plot(long_2,color=color.blue,linewidth=3)

plot(profit1,color=color.red,   linewidth=1)
plot(profit2,color=color.blue,  linewidth=1)

//plot(stoploss__1,style=plot.style_circles, color=color.yellow) 
//plot(stoploss__2,style=plot.style_circles, color=color.yellow) 

plot(stoploss1,style=plot.style_circles, color=color.blue) 
plot(stoploss2,style=plot.style_circles, color=color.red) 
//--------------------------------------------------------------

もっと