
이중 해안 파격 전략은 해안 거래법의 파격 전략과 린다 라슈크의 이동적 손실 원칙을 결합하여 우수한 파격 성능과 엄격한 위험 관리를 갖는다. 이 전략은 가격의 상하 파격을 동시에 모니터링하고, 파격이 발생했을 때 상장 또는 상장을 설정하고, 이동적 손실과 이동적 중지 관리 위치를 활용한다.
핵심 논리는 큰 주기의 최고점에 작은 주기의 최고점을 돌파할 때 공백을 하고, 큰 주기의 낮은 곳에서 작은 주기의 낮은 곳을 돌파할 때 더 많이 하는 것이다. 포지션을 세운 후, 이동 스톱과 이동 스톱을 설정하고, 먼저 스톱을 확인하는 위험을 감수한다. 포지션 수가 설정된 스톱의 수에 축적되면, 다음 주기에 스톱을 취소하고, 포지션을 반으로 나와 이동 스톱과 이동 스톱을 설정하여 수익을 잠금하고 가격 차이를 추적한다.
다음 단계로 진행됩니다.
이 전략은 포괄적이고, 다음과 같은 장점을 가지고 있습니다.
주요 위험과 대응 방법은 다음과 같습니다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
이중 해파리 돌파구 전략은 종합적으로 이중주기 기술, 돌파구 이론 및 엄격한 위험 관리 수단을 적용하여 높은 승률을 유지하면서도 수익의 안정성을 보장합니다. 이 전략 모델은 간단하고 명확하며 이해하기 쉽고 적용하기 쉽습니다.
/*backtest
start: 2022-11-21 00:00:00
end: 2023-11-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Turtle soup plus one", shorttitle = "Turtle soup plus one", overlay=true)
bigPeriod = input(20)
smallPeriod = input(4)
takeProfitBars = input(0)
trailingStop = input(5, title = "Trailing stop percentages")
if (strategy.position_size == 0)
strategy.cancel("Long")
strategy.cancel("Short")
strategy.cancel("Stop")
stopLossPrice = 0.1
stopLossPrice := nz(stopLossPrice[1])
takeProfitStarted = false
takeProfitStarted := nz(takeProfitStarted[1])
prevHigh = highest(high, bigPeriod - smallPeriod)[smallPeriod]
smallPeriodHigh = highest(high, smallPeriod - 1)[1]
if (high > prevHigh and prevHigh > smallPeriodHigh and close > prevHigh and strategy.position_size == 0)
strategy.order("Short", strategy.short, stop = prevHigh)
if strategy.position_size < 0 and strategy.position_size[1] == 0
stopLossPrice := high[1]
strategy.order("Stop", strategy.long, qty = -strategy.position_size, stop = stopLossPrice)
takeProfitStarted := false
if (strategy.position_size < 0 and sum(strategy.position_size, takeProfitBars) == strategy.position_size * takeProfitBars and close < strategy.position_avg_price and not takeProfitStarted)
takeProfitStarted := true
strategy.cancel("Stop")
strategy.order("ExitHalf", strategy.long, qty = ceil(-strategy.position_size / 2), stop = close)
if (strategy.position_size != -1)
strategy.exit("ExitFull", "Short", qty = -strategy.position_size - ceil(-strategy.position_size / 2), loss = stopLossPrice, trail_price = close, trail_offset = -(close - strategy.position_avg_price) * trailingStop / 100 / syminfo.mintick)
prevLow = lowest(low, bigPeriod - smallPeriod)[smallPeriod]
smallPeriodLow = lowest(low, smallPeriod - 1)[1]
if (low < prevLow and prevLow < smallPeriodLow and close < prevLow and strategy.position_size == 0)
strategy.order("Long", strategy.long, stop = prevLow)
if strategy.position_size > 0 and strategy.position_size[1] == 0
stopLossPrice := low[1]
strategy.order("Stop", strategy.short, qty = strategy.position_size, stop = stopLossPrice)
takeProfitStarted := false
if (strategy.position_size > 0 and sum(strategy.position_size, takeProfitBars) == strategy.position_size * takeProfitBars and close > strategy.position_avg_price and not takeProfitStarted)
takeProfitStarted := true
strategy.cancel("Stop")
strategy.order("ExitHalf", strategy.short, qty = ceil(strategy.position_size / 2), stop = close)
if (strategy.position_size != 1)
strategy.exit("ExitFull", "Long", qty = strategy.position_size - ceil(strategy.position_size / 2),loss = stopLossPrice, trail_price = close, trail_offset = (close - strategy.position_avg_price) * trailingStop / 100 / syminfo.mintick)
// === Backtesting Dates ===
testPeriodSwitch = input(false, "Custom Backtesting Dates")
testStartYear = input(2018, "Backtest Start Year")
testStartMonth = input(3, "Backtest Start Month")
testStartDay = input(6, "Backtest Start Day")
testStartHour = input(08, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,testStartHour,0)
testStopYear = input(2038, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(14, "Backtest Stop Day")
testStopHour = input(14, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,testStopHour,0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
isPeriod = testPeriodSwitch == true ? testPeriod() : true
// === /END
if not isPeriod
strategy.cancel_all()
strategy.close_all()