이중 추적 거북이 거래 전략

저자:차오장, 날짜: 2023-12-20 13:37:31
태그:

img

전반적인 설명

이 전략은 손실을 제한하기 위해 거북이 거래 규칙을 기반으로 두 개의 추적 스톱 로스 포인트를 활용하며 다른 매개 변수를 설정하여 시장 소음을 필터링하고 더 두드러진 추세를 입력합니다.

전략 논리

전략은 주로 두 개의 추적 스톱 로스 포인트인 롱_1 및 롱_2에 의존하여 엔트리 신호를 결정합니다. 롱_1은 장기 트렌드를 추적하고 롱_2는 단기 트렌드를 추적합니다. 이윤1 및 이윤2는 스톱 로스 포인트로 작용합니다.

만약 가격이 long_1보다 높다면 시장은 장기적인 상승 추세에 있다. 만약 가격이 long_2보다 낮아지면 단기적 인 인기를 나타냅니다. 만약 가격이 long_1보다 낮다면 장기적인 트렌드가 확인되지 않습니다. 하지만 가격이 long_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) 
//--------------------------------------------------------------

더 많은