
이 전략은 부린 밴드 (Bollinger Bands) 와 상대적으로 약한 지표 (RSI) 를 결합한 평균 회귀 거래 시스템이다. 이 전략은 가격의 평균에서 벗어난 극단적인 상황을 식별하고 RSI 오버 바이 오버 세 신호와 결합하여 거래 시기를 결정한다. 가격이 부린 밴드를 돌파하고 RSI가 오버 세 영역에있을 때 더 많은 신호를 생성하고, 가격이 부린 밴드를 돌파하고 RSI가 오버 바이 영역에있을 때 빈 신호를 생성한다.
전략의 핵심 논리는 금융 시장의 평균 회귀 특성에 기반한다. 구체적으로 구현할 때, 20일 간소 이동 평균 ((SMA) 을 평균 참조로 사용하고, 표준 차이의 곱이 2.0로 부린 대역폭을 계산한다. 14일 RSI를 보조 지표로 도입하고, 70과 30을 초과 구매 초과 판매 시점으로 설정한다. 전략은 가격이 부린 대역을 뚫고 RSI가 극한에 도달했을 때 거래 신호를 유발한다. 이 쌍 확인 메커니즘은 전략의 신뢰성을 높인다.
이 전략은 브린 띠와 RSI의 연동 작용을 통해 안정적인 평균 회귀 거래 시스템을 구축한다. 전략 설계는 합리적이며, 좋은 확장성과 적응성을 가지고 있다. 지속적인 최적화와 개선을 통해 전략의 안정성과 수익성을 더욱 향상시킬 수 있다. 실물 거래 전에 충분한 피드백 검증을 수행하고 특정 시장 특성에 따라 파라미터 설정을 조정하는 것이 좋습니다.
/*backtest
start: 2024-11-19 00:00:00
end: 2024-12-18 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Mean Reversion Strategy", overlay=true)
// User Inputs
length = input.int(20, title="SMA Length") // Moving Average length
stdDev = input.float(2.0, title="Standard Deviation Multiplier") // Bollinger Band deviation
rsiLength = input.int(14, title="RSI Length") // RSI calculation length
rsiOverbought = input.int(70, title="RSI Overbought Level") // RSI overbought threshold
rsiOversold = input.int(30, title="RSI Oversold Level") // RSI oversold threshold
// Bollinger Bands
sma = ta.sma(close, length) // Calculate the SMA
stdDevValue = ta.stdev(close, length) // Calculate Standard Deviation
upperBand = sma + stdDev * stdDevValue // Upper Bollinger Band
lowerBand = sma - stdDev * stdDevValue // Lower Bollinger Band
// RSI
rsi = ta.rsi(close, rsiLength) // Calculate RSI
// Plot Bollinger Bands
plot(sma, color=color.orange, title="SMA") // Plot SMA
plot(upperBand, color=color.red, title="Upper Bollinger Band") // Plot Upper Band
plot(lowerBand, color=color.green, title="Lower Bollinger Band") // Plot Lower Band
// Plot RSI Levels (Optional)
hline(rsiOverbought, "Overbought Level", color=color.red, linestyle=hline.style_dotted)
hline(rsiOversold, "Oversold Level", color=color.green, linestyle=hline.style_dotted)
// Buy and Sell Conditions
buyCondition = (close < lowerBand) and (rsi < rsiOversold) // Price below Lower Band and RSI Oversold
sellCondition = (close > upperBand) and (rsi > rsiOverbought) // Price above Upper Band and RSI Overbought
// Execute Strategy
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Optional: Plot Buy/Sell Signals
plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=sellCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")