
이 전략은 해파리 거래법을 활용하여 두 개의 추적 스톱포트를 설정하고, 이중 추적 스톱포드를 통해 손실을 제한하며, 동시에 다른 파라미터를 설정하여 시장 소음을 필터링하고, 트렌드가 더 분명할 때 구매한다.
이 전략은 주로 두 개의 추적 스톱 포인트 long_1 및 long_2를 통해 구매 시기를 결정한다. long_1은 더 긴 기간의 추세를 추적하고, long_2는 더 짧은 기간의 추세를 추적한다. 동시에 profit1과 profit2를 중지 포인트로 설정한다.
만약 가격이 long_1보다 높으면, 시장은 더 긴 기간 상승 추세에 있다. 이 시점에 만약 가격이 long_2보다 낮으면, shorterm의 회전이 더 좋은 입시 시기를 제공한다는 것을 의미하면, 입시한다. 만약 가격이 long_1보다 낮으면, 더 긴 기간에는 추세가 결정되지 않는다.
진입 후, 두 개의 추적 스톱 손실 지점 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)
//--------------------------------------------------------------