
この戦略は,海取引法を活用して2つの追跡ストップポイントを設置し,ダブルトラッキングストップで損失を制限し,同時に異なるパラメータを設定して市場騒音をフィルターし,傾向がより明らかなときに買い物をします.
この戦略は,主に2つのストップポイントlong_1とlong_2を追跡して購入のタイミングを決定する. long_1はより長期のトレンドを追跡し,long_2はより短期のトレンドを追跡する.同時に,profit1とprofit2をストップポイントとして設定する.
価格がlong_1より高い場合,市場はより長期の上昇傾向にある.このとき,価格がlong_2より低い場合,ショートtermの逆転が良い入場時間を提供することを示す場合,入場する.価格がlong_1より低い場合,長期はトレンドを決定していない.shorterm 価格がlong_2より高い場合,短期の反転が表示されても,入場することもできる.
入場後,2つの追跡ストップポイントを設定する.stoploss1とstoploss2を設定し,profit1とprofit2と最大値を比較して,利益をロックする.
longとprofitのパラメータを適切に調整することで,戦略をより進取的にし,取引回数を増加させることができる。同時に,止損点アルゴリズムを最適化し,自動調整を実現する。
この戦略は全体的に保守的で,安定した成長に適した投資家である.パラメータ調整と止損アルゴリズムの最適化により,戦略の進取性を適切に増やすことができる.さらに,市場騒音をフィルターするメカニズムを増やすことも後続的な最適化方向である.
/*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)
//--------------------------------------------------------------