피벗 포인트와 피보나치 수정을 기반으로 한 자동화된 추세 추종 전략


생성 날짜: 2024-01-05 11:34:17 마지막으로 수정됨: 2024-01-05 11:34:17
복사: 0 클릭수: 687
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

피벗 포인트와 피보나치 수정을 기반으로 한 자동화된 추세 추종 전략

개요

이 전략은 축점과 피포나치 회귀비율을 기반으로 주가 가격의 ABC 파도를 자동으로 식별하고 장단 포지션 신호를 준다. 전략은 축점을 사용하여 주가 가격 파도를 판단하고 ABC 파동 사이의 피포나치 회귀비율을 계산하여 특정 조건을 충족하면 거래 신호를 발생시킨다.

전략 원칙

  1. 주식의 중심축의 높고 낮은 점을 계산하는 방법
  2. 가격의 상승과 하락을 판단하는 방법
  3. 현재 파동과 이전 파동 사이의 피보나치 회귀 비율을 계산합니다.
  4. 상승파와 하락파의 회귀비율이 적절한 범위 안에 있다면 ABC파가 형성될 수 있다고 판단된다.
  5. ABC파역 확인 후, 더할 때 중지 손실을 C 포인트로 설정하고, 중지 중지 1.5 배의 변동; 공백을 할 때 중지 손실을 A 포인트로 설정하고, 중지 중지 1.5 배의 변동

우위 분석

  1. 축점으로 중요한 지지 저항 영역을 판단하여 신호의 정확도를 향상시킵니다.
  2. 피보나치 회귀를 적용하여 ABC 형태를 인식하고 트렌드 전환점을 자동으로 캡처합니다.
  3. 정지 손실은 명확하고 합리적이며 큰 손실을 피합니다.

위험 분석

  1. 축점과 피보나치 회귀는 트렌드 전환점을 매번 정확하게 판단할 수 없으므로 잘못된 판단이 발생할 수 있습니다.
  2. C점과 A점의 정지점이 뚫려서 손실이 커질 수 있습니다.
  3. 피보나치 회수율의 범위와 같은 파라미터 최적화가 필요합니다.

최적화 방향

  1. 더 많은 기술 지표와 결합하여 ABC 형태를 판단하여 신호의 정확도를 향상시킬 수 있습니다.
  2. 피보나치 회수율의 범위는 더 많은 시장 상황에 맞게 최적화할 수 있습니다.
  3. 기계학습과 결합하여 ABC 형태를 판단하는 모델을 훈련할 수 있다.

요약하다

이 전략은 중심축점을 기반으로 핵심지원저항구역을 판단하고, 피보나치 회수율을 이용하여 ABC 형태를 자동으로 식별하여, 진영 전환점에서 장단거래 신호를 준다. 전략의 논리는 명확하고 간결하며, 스톱 스톱 손실 설정은 합리적이며, 위험을 효과적으로 제어할 수 있다. 그러나 또한 잘못된 판단의 위험이 있으며, 더 많은 시장 상황에 적응하기 위해 추가적인 최적화와 개선이 필요하다.

전략 소스 코드
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-19 23:59:59
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kerok3g

//@version=5
strategy("ABCD Strategy", shorttitle="ABCDS", overlay=true, commission_value=0.04)
calcdev(fprice, lprice, fbars, lbars) =>
    rise = lprice - fprice
    run = lbars - fbars
    avg = rise/run
    ((bar_index - lbars) * avg) + lprice

len = input(5)

ph = ta.pivothigh(len, len)
pl = ta.pivotlow(len, len)

var bool ishigh = false
ishigh := ishigh[1]

var float currph = 0.0
var int currphb = 0
currph := nz(currph)
currphb := nz(currphb)

var float oldph = 0.0
var int oldphb = 0
oldph := nz(oldph)
oldphb := nz(oldphb)

var float currpl = 0.0
var int currplb = 0
currpl := nz(currpl)
currplb := nz(currplb)

var float oldpl = 0.0
var int oldplb = 0
oldpl := nz(oldpl)
oldplb := nz(oldplb)

if (not na(ph))
    ishigh := true
    oldph := currph
    oldphb := currphb
    currph := ph
    currphb := bar_index[len]
else
    if (not na(pl))
        ishigh := false
        oldpl := currpl
        oldplb := currplb
        currpl := pl
        currplb := bar_index[len]

endHighPoint = calcdev(oldph, currph, oldphb, currphb)
endLowPoint = calcdev(oldpl, currpl, oldplb, currplb)

plotshape(ph, style=shape.triangledown, color=color.red, location=location.abovebar, offset=-len)
plotshape(pl, style=shape.triangleup, color=color.green, location=location.belowbar, offset=-len)

// var line lnhigher = na
// var line lnlower = na
// lnhigher := line.new(oldphb, oldph, bar_index, endHighPoint)
// lnlower := line.new(oldplb, oldpl, bar_index, endLowPoint)
// line.delete(lnhigher[1])
// line.delete(lnlower[1])

formlong = oldphb < oldplb and oldpl < currphb and currphb < currplb
longratio1 = (currph - oldpl) / (oldph - oldpl)
longratio2 = (currph - currpl) / (currph - oldpl)

formshort = oldplb < oldphb and oldphb < currplb and currplb < currphb
shortratio1 = (oldph - currpl) / (oldph - oldpl)
shortratio2 = (currph - currpl) / (oldph - currpl)

// prevent multiple entry for one pattern
var int signalid = 0
signalid := nz(signalid[1])

longCond = formlong and 
           longratio1 < 0.7 and 
           longratio1 > 0.5 and 
           longratio2 > 1.1 and 
           longratio2 < 1.35 and 
           close < oldph and 
           close > currpl and 
           signalid != oldplb
if (longCond)
    signalid := oldplb
    longsl = currpl - ta.tr
    longtp = ((close - longsl) * 1.5) + close
    strategy.entry("Long", strategy.long)
    strategy.exit("Exit Long", "Long", limit=math.min(longtp, oldph), stop=longsl)

shortCond = formshort and 
             shortratio1 < 0.7 and 
             shortratio1 > 0.5 and 
             shortratio2 > 1.1 and 
             shortratio2 < 1.35 and 
             close > oldpl and 
             close < currph and 
             signalid != oldphb

if (shortCond)
    signalid := oldphb
    shortsl = currph + ta.tr
    shorttp = close - ((shortsl - close) * 1.5)
    strategy.entry("Short", strategy.short)
    strategy.exit("Exit Short", "Short", limit=math.max(shorttp, oldpl), stop=shortsl)