거북이 브레이크아웃 리트레이스먼트 적응형 트레이딩 전략


생성 날짜: 2023-12-08 11:54:02 마지막으로 수정됨: 2023-12-08 11:54:02
복사: 0 클릭수: 732
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

거북이 브레이크아웃 리트레이스먼트 적응형 트레이딩 전략

개요

이 전략은 주로 트렌드 브레이크 원칙에 기반하고 있으며, 채널 브레이크의 방법을 결합하여 트렌드 방향을 판단하기 위해 빠른 선과 느린 선의 쌍로 브레이크를 사용합니다. 이 전략은 브레이크 엔트리와 회수 엑시트를 동시에 두 배로 보호하여 시장 변동에 효과적으로 대응 할 수 있습니다. 전략의 가장 큰 장점은 실시간으로 계정 회수를 모니터링 할 수 있다는 것입니다. 회수가 일정 비율을 초과하면 지위 규모를 적극적으로 줄일 수 있습니다.

전략 원칙

  1. 빠른 느린 선 쌍레일: 각각 빠른 선과 느린 선을 사용하여 통로를 구축한다. 빠른 선의 반응 속도가 빠르며 느린 선의 부드러움이 높다. 쌍레일과 결합하면 트렌드 방향을 판단한다.

  2. 파격 엔트리: 가격이 상향 채널을 돌파할 때 더 많이 하고, 하향 채널을 돌파할 때 공백을 다.

  3. 회수 exits: 실시간으로 최대 회수를 모니터링한다. 회수 exits에 도달하면 평평한 위치를 중지한다. 회수 exits는 시장 환경에 따라 조정할 수 있다.

  4. 포지션 규모 적응: 포지션 수를 계정 권익에 따라 실시간으로 조정하고, 시장 위험을 회피한다. 계정 철수량이 커질수록 포지션이 적을수록 위험 저항성이 강하다.

전략적 이점

  1. 이중 경로 + 돌파구 진입, 추세를 판단하는 것이 더 정확하다.

  2. 손해 방지 장치, 단독 손실을 효과적으로 제어한다.

  3. 계좌 철수를 실시간으로 모니터링하고, 주식을 주식 규모로 조정하여 시장 위험을 줄입니다.

  4. 포지션 규모는 계정 권익과 연계되어 있으며, 위험 저항성이 강하여 시장 변동에 대응할 수 있다.

전략적 위험

  1. 큰 충격의 상황에서는, 회수 통제가 효과가 없어져 손실이 확대될 수 있다.

  2. 단속선이 중립 영역에 진입할 때, 여러 번 무효 뚫림 신호가 발생할 수 있다.

  3. 은 선이 너무 부드러우므로 빠른 역전을 적시에 잡을 수 없습니다.

  4. 다공간 혼합이용시, 양방향 보관소는 격납실 위험이 있다.

전략 최적화 방향

  1. 큰 진동의 경우, 과도한 정지 손실을 방지하기 위해 더 높은 철회 용량을 설정할 수 있습니다.

  2. 중립 영역 필터링을 추가하여 중립 영역 무효 신호를 피하십시오.

  3. 느린 선 통로에 대한 파라미터 최적화, 빠른 상황에 대한 반응 속도를 높인다.

  4. 양방향으로 보관할 수 있는 포장을 피하기 위해 포장 배치 규칙을 추가했다.

요약하다

이 전략은 전체적으로 중·장기 트렌드 거래에 적합한 효과적인 전략이다. 이 전략의 가장 큰 장점은 실시간으로 회수 모니터링과 동적으로 포지션을 조정하는 것이다. 이것은 전략이 포지션 규모를 자동으로 조정할 수 있게 하고, 시장에 강한 적응력을 갖는다.

전략 소스 코드
//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)