
이 전략은 평균 회귀 이론에 기반한 정량 거래 시스템으로, 부린 밴드, RSI 지표와 ATR 동적 손실 메커니즘을 결합한다. 이 전략은 가격의 평균에서 벗어난 극단적인 상황을 식별하여 거래한다. 가격이 부린 밴드 아래로 이동하고 RSI가 초매 지역에있을 때 더 많이 거래하고, 가격이 부린 밴드 위로 이동하고 RSI가 초매 지역에있을 때 공백을 만들고, ATR 동적 위치를 설정하여 손실을 중지하고 수익을 효과적으로 관리한다.
이 전략은 20주기 브린 띠를 주요 트렌드 판단 지표로 사용하고, 표준 격차 배수는 2.0으로 설정되어 가격 변동의 상하 경계를 결정한다. 동시에 14주기 RSI를 보조 지표로 도입하고, RSI는 30보다 낮으면 과매가 되고, 70보다 높으면 과매가 된다. 가격이 브린 띠의 궤도를 벗어나고 RSI는 30보다 낮으면 시장이 과매할 가능성이 있음을 나타내고, 시스템이 더 많은 신호를 낸다. 가격이 브린 띠의 궤도를 벗어나고 RSI는 70보다 높으면 시장이 넘어갈 가능성이 있음을 나타내고, 시스템이 공백 신호를 낸다. 이 전략은 브린 띠의 궤도를 수익의 종점으로 사용하고, RSI를 역으로 돌파하는 포지션 관리를 한다. 또한, 전략은 14주기 ATR 기반의 동적 스톱 손실 메커니즘을 도입하고, ATR 2배로 손실을 설정하고, ATR 3배로 위험을 중지하여, 보다 정확한 위험 통제를 실현한다.
이 전략은 브린 띠와 RSI의 조합 응용을 통해 완전한 평균 회귀 거래 시스템을 구축한다. ATR 동적 스톱의 도입은 위험을 효과적으로 제어하고, 전략이 좋은 위험 수익 특성을 갖는다. 약간의 최적화 공간이 있지만, 전체적인 설계 개념은 명확하고 실용성이 강하다. 상인은 실내에서 적용할 때 특정 시장 특성에 따라 매개 변수를 조정하고, 전략의 성능을 지속적으로 모니터링하는 것이 좋습니다.
/*backtest
start: 2024-11-19 00:00:00
end: 2024-11-26 00:00:00
period: 15m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SOL/USDT Mean Reversion Strategy", overlay=true)
// Input parameters
length = input(20, "Bollinger Band Length")
std_dev = input(2.0, "Standard Deviation")
rsi_length = input(14, "RSI Length")
rsi_oversold = input(30, "RSI Oversold")
rsi_overbought = input(70, "RSI Overbought")
// Calculate indicators
[middle, upper, lower] = ta.bb(close, length, std_dev)
rsi = ta.rsi(close, rsi_length)
// Entry conditions
long_entry = close < lower and rsi < rsi_oversold
short_entry = close > upper and rsi > rsi_overbought
// Exit conditions
long_exit = close > middle or rsi > rsi_overbought
short_exit = close < middle or rsi < rsi_oversold
// Strategy execution
if (long_entry)
strategy.entry("Long", strategy.long)
if (short_entry)
strategy.entry("Short", strategy.short)
if (long_exit)
strategy.close("Long")
if (short_exit)
strategy.close("Short")
// Stop loss and take profit
atr = ta.atr(14)
strategy.exit("Long SL/TP", "Long", stop=strategy.position_avg_price - 2*atr, limit=strategy.position_avg_price + 3*atr)
strategy.exit("Short SL/TP", "Short", stop=strategy.position_avg_price + 2*atr, limit=strategy.position_avg_price - 3*atr)
// Plot indicators
plot(middle, color=color.yellow, title="BB Middle")
plot(upper, color=color.red, title="BB Upper")
plot(lower, color=color.green, title="BB Lower")
// Plot entry and exit points
plotshape(long_entry, title="Long Entry", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(short_entry, title="Short Entry", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plotshape(long_exit, title="Long Exit", location=location.abovebar, color=color.orange, style=shape.circle, size=size.small)
plotshape(short_exit, title="Short Exit", location=location.belowbar, color=color.orange, style=shape.circle, size=size.small)