Turtle Breakout Drawdown Adaptive Trading Strategy

Author: ChaoZhang, Date: 2023-12-08 11:54:02
Tags:

img

Overview

This strategy is mainly based on the trend breakout principle, combined with the channel breakout method, using fast and slow double rails to break through to determine the trend direction. The strategy has double protection of breakout entries and drawdown exits at the same time, which can effectively deal with sudden market changes. The biggest advantage of the strategy is that it can monitor the account drawdown in real time. When the drawdown exceeds a certain percentage, it will actively reduce the position size. This allows the strategy to effectively control market risk and account risk resistance.

Strategy Logic

  1. Fast and slow double rails: Fast and slow lines are used to build channels respectively. The fast line responds faster and the slow line is smoother. Determine the trend direction by combining double rail breakthroughs.

  2. Breakout entries: go long when the price breaks through the upward channel, and go short when it breaks through the downward channel. Use stop orders to reduce risk.

  3. Drawdown exits: Real-time monitoring of maximum drawdown. Once the drawdown exit point is reached, it will actively stop loss to close positions. The drawdown exit point can be adjusted according to market conditions.

  4. Adaptive position sizing: The number of positions is adjusted in real time based on account equity to avoid market risk. The smaller the account drawdown, the fewer positions held. Stronger risk resistance.

Advantages

  1. Double rail channel + breakout entries, more accurate trend judgment.

  2. Stop loss and take profit mechanism effectively controls single loss.

  3. Real-time monitoring of account drawdown and active adjustment of position size to reduce market risk.

  4. Position size is linked to account equity with strong risk resistance to cope with sudden market changes.

Risks

  1. Drawdown control may fail in volatile markets, leading to greater losses.

  2. Multiple invalid breakthrough signals may occur when the fast line enters the neutral zone.

  3. The slow line is too smooth to capture rapid reversal trends in time.

  4. There is a risk of lock-in with mixed long and short positions.

Optimization

  1. Set higher drawdown tolerance for volatile markets to avoid over stop loss.

  2. Add neutral zone filtering to avoid invalid signals.

  3. Optimize parameters of the slow channel to improve response speed to fast markets.

  4. Add opening order sorting rules to avoid lock-in with two-way positions.

Conclusion

Overall, this is an effective strategy suitable for medium and long term trend trading. The biggest advantage of the strategy is real-time drawdown monitoring and dynamic adjustment of positions. This allows the strategy to automatically adjust the position size with strong adaptability to the market. When there is a sharp market change or price fluctuation, the strategy can automatically reduce the position size to effectively prevent the loss from expanding. This is difficult for many traditional strategies. In general, the idea of this strategy is innovative with strong practicality. It is worth exploring and optimizing for application.


//Noro
//2020

//Original idea from «Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders» (2007, CURTIS FAITH, ISBN: 9780071486644) 

//@version=4
strategy("Noro's Turtles Strategy", shorttitle = "Turtles str", overlay = true, default_qty_type = strategy.percent_of_equity, initial_capital = 100, default_qty_value = 100, commission_value = 0.1)

//Settings
needlong = input(true, title = "Long")
needshort = input(false, title = "Short")
sizelong = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot long, %")
sizeshort = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot short, %")
needfast = input(true, title = "Fast")
needslow = input(true, title = "Slow")
enter_fast = input(20, minval=1)
exit_fast = input(10, minval=1)
enter_slow = input(55, minval=1)
exit_slow = input(20, minval=1)
showof = input(true, title = "Show offset")
showll = input(false, title = "Show lines")
showlabel = input(true, defval = true, title = "Show label")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Fast
fastL = highest(enter_fast)
fastLC = lowest(exit_fast)
fastS = lowest(enter_fast)
fastSC = highest(exit_fast)

//Slow
slowL = highest(enter_slow)
slowLC = lowest(exit_slow)
slowS = lowest(enter_slow)
slowSC = highest(exit_slow)

//Lines
offset = showof ? 1 : 0
col1 = showll and needlong and needfast ? color.blue : na
col2 = showll and needshort and needfast ? color.red : na
col3 = showll and needlong and needslow ? color.blue : na
col4 = showll and needshort and needslow ? color.red : na
plot(fastL, color = col1, offset = offset)
plot(fastLC, color = col1, offset = offset)
plot(fastS, color = col2, offset = offset)
plot(fastSC, color = col2, offset = offset)
plot(slowL, color = col3, offset = offset)
plot(slowLC, color = col3, offset = offset)
plot(slowS, color = col4, offset = offset)
plot(slowSC, color = col4, offset = offset)

//Orders
truetime = time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
size = strategy.position_size
lotlong = 0.0
lotlong := size != size[1] ? strategy.equity / close * sizelong / 100 : lotlong[1]
lotshort = 0.0
lotshort := size != size[1] ? strategy.equity / close * sizeshort / 100 : lotshort[1]

//Fast
strategy.entry("fast L", strategy.long, lotlong, stop = fastL, when = needfast and needlong and strategy.position_size == 0 and truetime)
strategy.entry("fast S", strategy.short, lotshort, stop = fastS, when = needfast and needshort and strategy.position_size == 0 and truetime)
strategy.exit("fast L", stop = fastLC, when = needfast and needlong and strategy.position_size > 0)
strategy.exit("fast S", stop = fastSC, when = needfast and needshort and strategy.position_size < 0)

//Slow
strategy.entry("slow L", strategy.long, lotlong, stop = slowL, when = needslow and needlong and strategy.position_size == 0 and truetime)
strategy.entry("slow S", strategy.short, lotshort, stop = slowS, when = needslow and needshort and strategy.position_size == 0 and truetime)
strategy.exit("slow L", stop = slowLC, when = needslow and needlong and strategy.position_size > 0)
strategy.exit("slow S", stop = slowSC, when = needslow and needshort and strategy.position_size < 0)

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()
    strategy.cancel("fast L")
    strategy.cancel("fast S")
    strategy.cancel("slow L")
    strategy.cancel("slow S")
    
if showlabel

    //Drawdown
    max = 0.0
    max := max(strategy.equity, nz(max[1]))
    dd = (strategy.equity / max - 1) * 100
    min = 100.0
    min := min(dd, nz(min[1]))
    
    //Label
    min := round(min * 100) / 100
    labeltext = "Drawdown: " + tostring(min) + "%"
    var label la = na
    label.delete(la)
    tc = min > -100 ? color.white : color.red
    osx = timenow + round(change(time)*10)
    osy = highest(100)


More