더블 트레일링 스톱 터틀 트레이딩 전략


생성 날짜: 2023-12-20 13:37:31 마지막으로 수정됨: 2023-12-20 13:37:31
복사: 1 클릭수: 628
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

더블 트레일링 스톱 터틀 트레이딩 전략

개요

이 전략은 해파리 거래법을 활용하여 두 개의 추적 스톱포트를 설정하고, 이중 추적 스톱포드를 통해 손실을 제한하며, 동시에 다른 파라미터를 설정하여 시장 소음을 필터링하고, 트렌드가 더 분명할 때 구매한다.

전략 원칙

이 전략은 주로 두 개의 추적 스톱 포인트 long_1 및 long_2를 통해 구매 시기를 결정한다. long_1은 더 긴 기간의 추세를 추적하고, long_2는 더 짧은 기간의 추세를 추적한다. 동시에 profit1과 profit2를 중지 포인트로 설정한다.

만약 가격이 long_1보다 높으면, 시장은 더 긴 기간 상승 추세에 있다. 이 시점에 만약 가격이 long_2보다 낮으면, shorterm의 회전이 더 좋은 입시 시기를 제공한다는 것을 의미하면, 입시한다. 만약 가격이 long_1보다 낮으면, 더 긴 기간에는 추세가 결정되지 않는다.

진입 후, 두 개의 추적 스톱 손실 지점 stoploss1 및 stoploss2를 설정하고, profit1,profit2와 비교하여 최대 값을 얻습니다.

우위 분석

  • 이중 추적 스톱로스를 통해 리스크를 효과적으로 제어하고 수익을 최대한 고정할 수 있습니다.
  • 장기간과 단기간의 두 종류의 지표와 결합하여 일부 잡음을 필터링하고, 더 명확한 추세에 진입할 수 있습니다
  • 자유 제어 전략의 보수성을 매개 변수로 조정할 수 있습니다.

위험 분석

  • 전략이 보수적이어서 일부 기회를 놓칠 수 있습니다.
  • 스톱포인트 설정이 잘못되면 너무 일찍 스톱포인트가 됩니다.
  • 더 적은 거래, 더 큰 손실 가능성

long 및 profit의 매개 변수를 적절히 조정하여 전략을 더 적극적으로 만들고 거래 횟수를 늘릴 수 있다. 또한 스톱로스 포인트 알고리즘을 최적화하여 자동 조정을 구현한다.

최적화 방향

  • 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) 
//--------------------------------------------------------------