
이 전략은 Z 점수 (Z-Score) 통계적 방법, 상대적으로 강한 지표 (RSI) 및 슈퍼 트렌드 (Supertrend) 지표를 결합한 정량 거래 시스템이다. 전략은 가격의 통계적 편차를 모니터링하고, 동력 지표와 트렌드 확인을 결합하여 시장에서 높은 확률의 기회를 찾고 거래한다. 이 전략은 시장의 과매도 과매 기회를 잡을 수 있을 뿐만 아니라, 트렌드 확인을 통해 거짓 신호를 필터링하여 다방면 양방향 거래를 실현할 수 있다.
전략의 핵심 논리는 세 가지 주요 기술 지표의 협동 작용에 기반합니다: 첫째, 75 주기의 이동 평균과 표준 차이를 사용하여 가격의 Z 점수를 계산하여 현재 가격의 역사적 평균에 대한 편차를 측정합니다. Z 점수가 1.1 이상 또는 -1.1 미만일 때, 가격이 눈에 띄는 통계적 편차를 나타냅니다. 둘째, RSI 지표를 동력으로 도입하여 RSI가 입장을 취하는 데 필요한 방향성을 확인합니다.
이것은 통계적 방법과 기술 분석을 통합한 정량 거래 전략으로, 다중 신호 확인을 통해 거래의 신뢰성을 높인다. 전략의 핵심 장점은 객관적인 수학적 모델과 완벽한 위험 제어 메커니즘에 있다. 그러나 또한 변수 최적화 및 시장 적응성의 문제에 주의를 기울여야 한다. 제안된 최적화 방향을 통해, 전략에는 더욱 향상될 여지가 있다. 특히 시장 환경에 동적으로 적응하고 위험을 제어하는 측면에서.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-11-26 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Z-Score Long and Short Strategy with Supertrend", overlay=true)
// Inputs for Z-Score
len = input.int(75, "Z-Score Lookback Length")
z_long_threshold = 1.1 // Threshold for Z-Score to open long
z_short_threshold = -1.1 // Threshold for Z-Score to open short
// Z-Score Calculation
z = (close - ta.sma(close, len)) / ta.stdev(close, len)
// Calculate Driver RSI
driver_rsi_length = input.int(14, "Driver RSI Length") // Input for RSI Length
driver_rsi = ta.rsi(close, driver_rsi_length) // Calculate the RSI
// Supertrend Parameters
atrPeriod = input.int(11, "ATR Length", minval=1)
factor = input.float(2.0, "Factor", minval=0.01, step=0.01)
// Supertrend Calculation
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// Conditions for Long and Short based on Z-Score
z_exceeds_long = z >= z_long_threshold and driver_rsi > 60
z_exceeds_short = z <= z_short_threshold and driver_rsi < 40
// Entry Conditions
if (z_exceeds_long and direction < 0) // Enter Long if Z-Score exceeds threshold and Supertrend is down
strategy.entry("Long", strategy.long)
label.new(bar_index, low, text="Open Long", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
alert("Open Long", alert.freq_once_per_bar) // Alert for Long entry
if (z_exceeds_short and direction > 0) // Enter Short if Z-Score exceeds threshold and Supertrend is up
strategy.entry("Short", strategy.short)
label.new(bar_index, high, text="Open Short", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
alert("Open Short", alert.freq_once_per_bar) // Alert for Short entry
// Plot Supertrend
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color=color.green, style=plot.style_linebr)
downTrend = plot(direction > 0 ? supertrend : na, "Down Trend", color=color.red, style=plot.style_linebr)
fill(upTrend, downTrend, color=color.new(color.green, 90), fillgaps=false)
// Alert conditions for Supertrend changes (optional)
alertcondition(direction[1] > direction, title='Downtrend to Uptrend', message='The Supertrend value switched from Downtrend to Uptrend')
alertcondition(direction[1] < direction, title='Uptrend to Downtrend', message='The Supertrend value switched from Uptrend to Downtrend')