
이 전략은 이동 평균 트렌드 이탈 지표 ((MACD) 와 상대적으로 강한 지표 ((RSI) 를 결합한 정량 거래 시스템이다. 이 전략은 이 두 가지 기술 지표의 교차 신호와 오버 바이 오버 셀 레벨을 분석하여 시장 트렌드 전환점을 식별하여 거래 결정을 내린다. 시스템은 프로그래밍 된 거래 방식을 채택하여 자동으로 시장 기회를 포착하고 거래를 할 수 있다.
전략의 핵심 논리는 두 가지 주요 기술 지표에 기반합니다: MACD와 RSI. MACD 지표는 빠른 이동 평균 (12 시) 과 느린 이동 평균 (26 시) 의 차이를 계산하여 신호 라인 (9 시 이동 평균) 과 비교하여 트렌드 방향을 판단합니다. RSI 지표는 14 주기의 상대적 강점을 계산하여 시장이 과매 또는 과매 상태인지 판단합니다.
MACD 라인이 신호 라인을 상향으로 가로질러 RSI가 70보다 낮으면 구매 신호를 생성하고 MACD 라인이 신호 라인을 상향으로 가로질러 RSI가 30보다 높으면 판매 신호를 생성합니다. 이 이중 확인 메커니즘은 가짜 신호를 효과적으로 필터링 할 수 있습니다.
MACD-RSI 동적 교차량 거래 시스템은 기술 분석의 클래식 지표와 결합한 자동화 거래 전략이다. MACD 트렌드 판단과 RSI 오버 구매 오버 판매 확인의 이중 메커니즘을 통해 시장 전환점을 효과적으로 포착할 수 있다. 전략은 높은 신뢰성, 조정성이 강하지만, 흔들림 시장과 신호 지연 등의 위험을 주의해야 한다. 다른 기술 지표와 최적화된 신호 확인 장치를 도입함으로써 전략에는 큰 개선 공간이 있다. 실제 응용에서는 투자자가 특정 시장 환경에 따라 변수를 조정하고 다른 분석 방법과 결합하여 사용하도록 권장한다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-03 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("MACD + RSI Strategy", overlay=true)
// MACD settings
fastLength = input.int(12, title="MACD Fast Length")
slowLength = input.int(26, title="MACD Slow Length")
signalSmoothing = input.int(9, title="MACD Signal Smoothing")
// RSI settings
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.float(70, title="RSI Overbought Level")
rsiOversold = input.float(30, title="RSI Oversold Level")
// Calculate MACD
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Generate buy and sell signals
buySignal = ta.crossover(macdLine, signalLine) and rsi < rsiOverbought
sellSignal = ta.crossunder(macdLine, signalLine) and rsi > rsiOversold
// Plot buy and sell signals on chart
plotshape(series=buySignal, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Strategy entry and exit
if buySignal
strategy.entry("Buy", strategy.long)
if sellSignal
strategy.close("Buy")
// Plot MACD and Signal Line
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
// Plot RSI
hline(rsiOverbought, "Overbought", color=color.red)
hline(rsiOversold, "Oversold", color=color.green)
plot(rsi, color=color.purple, title="RSI")