
돌파 회귀 거래 전략은 가격의 절대 강도 지표와 MACD 지표를 계산하여 특정 추세 아래 돌파 회귀 거래를 실현하는 짧은 라인 거래 전략에 속한다. 이 전략은 여러 지표를 통합하여 큰 추세, 중간 추세 및 단기 추세를 판단하고, 추세 동향과 지표 상호 보완 확인 신호를 통해 추세를 추적한다.
이 전략은 주로 가격의 절대 강도 지표와 MACD 지표에 기반하여 돌파 회귀 거래를 달성한다. 우선 가격의 9주기, 21주기 및 50주기 EMA를 계산하여 큰 트렌드 방향을 판단한다. 다음으로 가격의 절대 강도 지표를 계산하여 단기 조정 강도를 반영한다. 마지막으로 MACD 지표를 계산하여 단기 트렌드 방향을 판단한다. 큰 트렌드가 상승하고 단기 조정이 있을 때 구매한다. 큰 트렌드가 하락하고 단기 반발이 있을 때 판매한다.
구체적으로, 품종 대동향은 상승을 위해 9일 EMA를 만족해야 하며 21일 EMA보다 높고, 21일 EMA가 50일 EMA보다 높습니다. 단기 조정 판단 기준은 절대 강도 지표 차이는 0보다 낮습니다. MACDDIFF는 0보다 작습니다. 품종 대동향을 위해 하락을 위해 9일 EMA를 만족해야 합니다. 21일 EMA보다 낮습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
위와 같은 위험을 위해, 최적화 매개 변수를 통해, 다른 주기적 지표를 판단할 수 있다. 포지션 보유 규칙을 조정, 단편적 손실을 제어; 더 많은 지표 필터 신호와 결합하여 정확도를 높이는 방법 등이 개선된다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
종합적으로 살펴보면, 돌파 회귀 거래 전략은 전체적으로 안정적인 단선 거래 전략이다. 그것은 큰, 작은, 다중의 추세 판단을 결합하여 불안정한 상황에서 잘못된 거래를 피한다. 동시에 지표 조합을 사용하면 판단의 정확도도 향상된다. 후속 테스트 및 최적화를 통해, 이 전략은 장기적으로 보유할 가치가 있는 안정적인 전략이 될 수 있다.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Divergence Scalper [30MIN]", overlay=true , commission_value=0.04 )
message_long_entry = input("long entry message")
message_long_exit = input("long exit message")
message_short_entry = input("short entry message")
message_short_exit = input("short exit message")
//3x ema
out9 = ta.ema(close,9)
out21 = ta.ema(close,21)
out50 = ta.ema(close,50)
//abs
absolute_str_formula( ) =>
top=0.0
bottom=0.0
if(close>close[1])
top:= nz(top[1])+(close/close[1])
else
top:=nz(top[1])
if(close<=close[1])
bottom:= nz(bottom[1])+(close[1]/close)
else
bottom:=nz(bottom[1])
if (top+bottom/2>=0)
1-1/(1+(top/2)/(bottom/2))
abs_partial=absolute_str_formula()
abs_final = abs_partial - ta.sma(abs_partial,50)
//macd
fast_length = input(title="Fast Length", defval=23)
slow_length = input(title="Slow Length", defval=11)
src = input(title="Source", defval=open)
signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval = 6)
sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"])
sma_signal = input.string(title="Signal Line MA Type", defval="SMA", options=["SMA", "EMA"])
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal
long= abs_final > 0 and hist <0 and out9<out21 and out21<out50
short = abs_final <0 and hist >0 and out9>out21 and out21>out50
long_exit = abs_final <0 and hist >0 and out9>out21 and out21>out50
short_exit = abs_final > 0 and hist <0 and out9<out21 and out21<out50
strategy.entry("long", strategy.long, when = long and barstate.isconfirmed, alert_message = message_long_entry)
strategy.entry("short", strategy.short, when = short and barstate.isconfirmed, alert_message = message_short_entry)
strategy.close("long", when = long_exit and barstate.isconfirmed, alert_message = message_long_exit)
strategy.close("short", when = short_exit and barstate.isconfirmed, alert_message = message_short_exit)