샤프 트렌드 사이클 동력 전략

저자:차오장, 날짜: 2023-11-01 16:08:35
태그:

img

전반적인 설명

이 전략은 슈프 트렌드 사이클 지표 (Schaff Trend Cycle) 를 기반으로, 스톡 RSI의 과잉 구매 및 과잉 판매 원칙과 결합하여 모멘텀 메트릭을 사용하여 트렌드를 결정하고 추적합니다. 가격이 과잉 판매 지역에서 과잉 구매 지역으로 돌파 할 때 길게 이동하고 가격이 과잉 구매 지역에서 과잉 판매 지역으로 돌파 할 때 짧게 이동합니다. 전략은 가격 트렌드의 변화를 포착함으로써 포지션을 동적으로 조정합니다.

전략 논리

    1. MACD를 계산합니다. 기본 속도가 23이고 속도가 50입니다. MACD는 가격 동력을 판단하기 위해 단기 및 장기 이동 평균의 차이를 반영합니다.
    1. MACD에 Stoch RSI를 적용하여 K 값을 형성합니다. 여기서 기본 사이클 길이는 10이며, MACD 모멘텀 메트릭의 과잉 구매/ 과잉 판매 수준을 반영합니다.
    1. K의 가중화 이동 평균을 D 형식으로 가져가기 위해 기본 1 %D 길이가 3이므로 K의 잡음을 제거합니다.
    1. 다시 D에 스톡 RSI를 적용하여 기본 STC 값을 형성합니다. 기본 2 %D 길이가 3 이므로 정확한 과소매/ 과소매 신호를 생성합니다.
    1. 초기 STC의 가중화 이동 평균을 받아 최종 STC 값을 얻습니다. 0-100 사이입니다. 75 이상의 STC는 과잉 구매되고 25 이하의 과잉 판매입니다.
    1. STC가 25보다 높을 때 길고, STC가 75보다 낮을 때 짧습니다.

장점

    1. 스톡 RSI를 결합한 STC 디자인은 과잉 구매/ 과잉 판매 지역을 명확하게 식별하여 강력한 트렌드 신호를 형성합니다.
    1. 이중 스톡 RSI 필터링은 가짜 파장을 효과적으로 제거합니다.
    1. STC의 표준화 된 0-100 범위는 직접적인 기계화 된 거래 신호를 허용합니다.
    1. 백테스트는 시각적인 브레이크아웃 마크와 텍스트 팝업 알림을 구현하여 명확하고 직관적인 신호를 캡처합니다.
    1. 최적화된 기본 매개 변수는 과민 신호와 불필요한 거래를 피합니다.

위험성

    1. STC는 매개 변수에 민감합니다. 다른 동전과 시간 프레임은 시장 특성에 맞게 매개 변수를 조정해야합니다.
    1. 탈출 전략은 함정에 빠지기 쉽기 때문에 위험을 통제하기 위해 멈춰야 합니다.
    1. 유동성이 낮은 가짜 브레이크는 나쁜 신호를 생성할 수 있어 볼륨 필터가 필요합니다.
    1. STC만으로는 역행 위험이 있습니다. 다른 요인을 사용하여 확인이 필요합니다.
    1. 나쁜 신호를 피하기 위해 주요 지지/저항 수준을 감시해야 합니다.

더 나은 기회

    1. MACD 매개 변수를 다양한 기간과 동전에 최적화합니다.
    1. STC 곡선을 부드럽게 하기 위해 Stoch RSI K와 D 값을 정제합니다.
    1. 부피 필터를 추가하면 유동성이 낮은 가짜 브레이크를 피할 수 있습니다.
    1. 신호를 확인하기 위해 추가 지표를 포함하십시오. 예를 들어 볼린거 밴드.
    1. 이동/ATR 정지 같은 정지 메커니즘을 추가합니다.
    1. 트렌드 확인을 위해 브레이크오웃 후 인회에 대해 입력하는 등 입력 조정.

결론

샤프 트렌드 사이클 전략은 단기 가격 트렌드 변화를 결정하기 위해 모멘텀 메트릭을 통해 과반 구매 / 과반 판매를 식별합니다. 간단하고 조정 가능하지만 함정 위험이 있습니다. 확정 및 중단은 강력한 트렌드에 대한 최적화를 지원합니다.


/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-31 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Schaff Trend Cycle script may be freely distributed under the MIT license.
strategy("Schaff Trend Cycle", shorttitle="STC Backtest", overlay=true)

fastLength = input(title="MACD Fast Length",  defval=23)
slowLength = input(title="MACD Slow Length",  defval=50)
cycleLength = input(title="Cycle Length",  defval=10)
d1Length = input(title="1st %D Length",  defval=3)
d2Length = input(title="2nd %D Length",  defval=3)
src = input(title="Source",  defval=close)
highlightBreakouts = input(title="Highlight Breakouts ?", type=bool, defval=true)

macd = ema(src, fastLength) - ema(src, slowLength)

k = nz(fixnan(stoch(macd, macd, macd, cycleLength)))

d = ema(k, d1Length)

kd = nz(fixnan(stoch(d, d, d, cycleLength)))

stc = ema(kd, d2Length)
stc := 	stc > 100 ? 100 : stc < 0 ? 0 : stc

//stcColor = not highlightBreakouts ? (stc > stc[1] ? green : red) : #ff3013
//stcPlot = plot(stc, title="STC", color=stcColor, transp=0)

upper = input(75, defval=75)
lower = input(25, defval=25)

transparent = color(white, 100)

upperLevel = plot(upper, title="Upper", color=gray)
// hline(50, title="Middle", linestyle=dotted)
lowerLevel = plot(lower, title="Lower", color=gray)

fill(upperLevel, lowerLevel, color=#f9cb9c, transp=90)

upperFillColor = stc > upper and highlightBreakouts ? green : transparent
lowerFillColor = stc < lower and highlightBreakouts ? red : transparent

//fill(upperLevel, stcPlot, color=upperFillColor, transp=80)
//fill(lowerLevel, stcPlot, color=lowerFillColor, transp=80)

long =  crossover(stc, lower) ? lower : na
short = crossunder(stc, upper) ? upper : na

long_filt = long and not short
short_filt = short and not long

prev = 0
prev := long_filt ? 1 : short_filt ? -1 : prev[1]

long_final = long_filt and prev[1] == -1
short_final = short_filt and prev[1] == 1

strategy.entry("long", strategy.long, when = long )
strategy.entry("short", strategy.short, when = short)

plotshape(crossover(stc, lower) ? lower : na, title="Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=green, transp=0)
plotshape(crossunder(stc, upper) ? upper : na, title="Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=red, transp=0)

alertcondition(long_final, "Long", message="Long")
alertcondition(short_final,"Short", message="Short")

plotshape(long_final, style=shape.arrowup, text="Long", color=green, location=location.belowbar)
plotshape(short_final, style=shape.arrowdown, text="Short", color=red, location=location.abovebar)


더 많은