
双海突破策は,海取引法の突破策とリンダ・ラシュクの移動ストップ原理を融合し,優れた突破性能と厳格なリスク管理を備えている.この策は,価格の上下突破を同時に監視し,突破が発生したときに多額のまたは空白のポジションを確立し,移動ストップと移動ストップの管理ポジションを利用する.
核心論理は,大周期高点で小周期高点を突破する時に空白し,大周期低点の下で小周期低点を突破する時に多めにすることである. ポジションを確立した後,移動ストップと移動ストップを設定し,まずストップを確定するリスクである. ポジション数が設定されたストップ数に蓄積される場合,次の周期でストップをキャンセルし,その後,ポジションを半分に外して移動ストップと移動ストップを設定し,利潤をロックし,差異を追跡する.
具体的には以下の通りです.
この戦略は統合的な突破策であり,以下の利点があります.
主要なリスクと対応策は以下の通りです.
この戦略は,以下の点で最適化できます.
双海突破戦略は,双周期技術,突破理論と厳格なリスク管理手段を総合的に適用し,高い勝率を維持しながら,収益の安定性を確保する.この戦略モデルは,単純で明確で,理解しやすく,適用しやすい,非常に優れた量化戦略である.この戦略には,多くの最適化余地があり,投資家は,この基礎で革新を行い,より優れた取引システムを構築することができます.
/*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()