Name
双海龟突破策略Double-Turtle-Breakthrough-Strategy
Author
ChaoZhang
Strategy Description
[trans]
双海龟突破策略融合了海龟交易法的突破策略和琳达·拉施克的移动止损原理,具有优异的突破性能和严格的风险控制。该策略同时监控价格的上下突破,在突破发生时建立做多或做空头寸,并利用移动止损和移动止盈管理头寸。
核心逻辑是在大周期高点上突破小周期高点时做空,在大周期低点下突破小周期低点时做多。建仓后设置移动止损和移动止盈,首先止损确认风险。在持仓数量累积到设置的止盈数量时,在下一个周期取消止损单,然后出半仓并设置移动止损和移动止盈锁定利润并追踪价差。
具体操作步骤是:
- 计算大周期(20周期)高点prevHigh和小周期(4周期)高点smallPeriodHigh。
- 当最新K线的high大于prevHigh,并且prevHigh大于smallPeriodHigh时,表明大周期高点突破小周期高点,此时若没有仓位则做空。
- 建仓后设置移动止损,待仓位反转后取消止损单,防止被止损。
- 当持仓数量达到设置的移动止盈周期数(当前为0周期)时,在下一个周期出一半仓位,并设置移动止损与移动止盈,追踪价差并锁定利润。
- 对于低点的突破类似,基于大周期低点和小周期低点的突破关系建立做多头寸。
这是一个综合性较强的突破策略,同时具有以下优势:
- 结合双周期海龟交易法,能够有效识别突破信号。
- 采用移动止损与移动止盈技术严格控制风险,避免巨亏。
- 分两次出场,一次止盈出半仓,再通过移动止盈出全仓,锁定利润。
- 兼顾做多和做空双向操作,符合多空互换的市场特点。
- 回测效果优异,具有很强的实盘表现能力。
主要的风险和应对措施如下:
- 假突破风险。应适当调整周期参数,确保突破的有效性。
- 追涨杀跌风险。应结合趋势和形态进行过滤,避免在趋势末期建仓。
- 止损被冲风险。可适当放宽止损幅度,确保有足够的空间。
- 移动止损过于灵敏风险。应调整止损后滑点设置,避免无谓止损。
该策略还可从以下几个方面进行优化:
- 增加成交量的突破过滤,确保突破的真实性。
- 加入趋势判断指标,避免在趋势末期建仓。
- 结合更多时间周期判断突破时机。
- 增加机器学习算法,动态优化参数。
- 组合其他策略,实施统计套利。
双海龟突破策略综合运用双周期技术、突破理论和严格的风险管理手段,在保持高胜率的同时也确保收益的稳定性。该策略模型简单清晰,易于理解与应用,是一款非常出色的量化策略。本策略还具有很大的优化空间,投资者可以在此基础上进行创新,打造更加出色的交易系统。
||
The Double Turtle Breakthrough Strategy integrates the turtle trading breakthrough strategy and Linda Raschke's moving stop loss principle, with excellent breakthrough performance and strict risk control. The strategy simultaneously monitors the price breakout up and down, establishes long or short positions when a breakthrough occurs, and uses moving stop loss and moving take profit to manage positions.
The core logic is to go short when breaking through the small cycle high on the large cycle high point, and go long when breaking through the small cycle low at the large cycle low point. After opening a position, set up a moving stop loss and moving take profit, first stop loss to confirm the risk. When the holding quantity accumulates to the set take profit quantity, cancel the stop loss order in the next cycle, then exit half of the position and set up a moving stop loss and moving take profit to lock in profits and track spreads.
The specific operation steps are:
-
Calculate the large cycle (20 cycles) high point prevHigh and the small cycle (4 cycles) high point smallPeriodHigh.
-
When the high of the latest K-line is greater than prevHigh, and prevHigh is greater than smallPeriodHigh, it indicates that the large cycle high point breaks through the small cycle high point. At this time, if there is no position, go short.
-
After opening a position, set a moving stop loss. Wait for the position to reverse before cancelling the stop loss order to prevent being stopped out.
-
When the holding quantity reaches the set moving take profit cycle number (currently 0 cycles), exit half of the position in the next cycle, and set up a moving stop loss and moving take profit to track the spread and lock in profits.
-
For breakthroughs of low points, long positions are established based on breakthrough relationships between large cycle lows and small cycle lows.
This is a highly comprehensive breakthrough strategy with the following advantages:
-
Combining double cycle turtle trading can effectively identify breakthrough signals.
-
The use of moving stop loss and moving take profit techniques strictly controls risks and avoids huge losses.
-
Exiting in two stages, taking profit half position at a time, then fully exiting through moving take profit, locking in profits.
-
Take into account both long and short operations, matching the characteristics of alternating multi-empty markets.
-
Excellent backtesting results with strong real trading performance.
The main risks and countermeasures are as follows:
-
Risk of false breakthroughs. Appropriately adjust cycle parameters to ensure breakthrough validity.
-
Risk of chasing rises and kills falls. Filtering should be combined with trends and patterns to avoid opening positions at the end of trends.
-
Risk of stop loss being washed out. Appropriately relax the stop loss amplitude to ensure sufficient space.
-
Risk of overly sensitive moving stop loss. Adjust slippage settings after stop loss to avoid unnecessary stop outs.
The strategy can also be optimized in the following aspects:
-
Add volume breakthrough filters to ensure authenticity of breakthroughs.
-
Add trend judgment indicators to avoid opening positions at the end of trends.
-
Combine more time cycles to determine breakthrough timing.
-
Increase machine learning algorithms for dynamic optimization of parameters.
-
Combine with other strategies for statistical arbitrage.
The Double Turtle Breakthrough Strategy comprehensively uses double cycle techniques, breakthrough theories and strict risk management methods to ensure high win rates while ensuring stable returns. This strategy model is simple and clear, easy to understand and apply, and it is an excellent quantitative strategy. This strategy still has great potential for optimization. Investors can innovate on this basis to create even better trading systems.
[/trans]
Strategy Arguments
Argument | Default | Description |
---|---|---|
v_input_1 | 20 | bigPeriod |
v_input_2 | 4 | smallPeriod |
v_input_3 | false | takeProfitBars |
v_input_4 | 5 | Trailing stop percentages |
v_input_5 | false | Custom Backtesting Dates |
v_input_6 | 2018 | Backtest Start Year |
v_input_7 | 3 | Backtest Start Month |
v_input_8 | 6 | Backtest Start Day |
v_input_9 | 8 | Backtest Start Hour |
v_input_10 | 2038 | Backtest Stop Year |
v_input_11 | 12 | Backtest Stop Month |
v_input_12 | 14 | Backtest Stop Day |
v_input_13 | 14 | Backtest Stop Hour |
Source (PineScript)
/*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()
Detail
https://www.fmz.com/strategy/433577
Last Modified
2023-11-28 16:25:41