
이 전략은 상대적으로 강하고 약한 지수 ((RSI) 와 간단한 이동 평균 ((SMA) 를 사용하여 시장에서 잠재적인 평균 회귀 기회를 식별합니다. RSI가 구매 경미보다 낮고 가격이 SMA보다 낮을 때 구매 신호가 발생하고 RSI가 판매 경미보다 높고 가격이 SMA보다 높을 때 판매 신호가 발생합니다. 이 전략은 거래 위험을 관리하고 수익을 잠금하기 위해 중지 및 중지 수준을 설정합니다.
이 전략의 핵심 원칙은 평균 회귀 개념으로, 극단적 인 수준에서 가격이 평균 근처로 돌아가는 경우가 많습니다. RSI 지표를 사용하여 가격의 과매매 및 과매매 상태를 측정하고, SMA를 가격의 기준으로 결합하여, 이 전략은 평균에서 너무 멀리 떨어져있는 가격의 회귀 기회를 잡으려고합니다.
특히, 이 전략은 다음과 같은 단계를 사용합니다.
이 상대적으로 강한 지수 평균값 회귀 전략은 RSI와 SMA를 사용하여 가격의 평균값 이탈 후의 회귀 기회를 잡는다. 그것은 간단하고 이해하기 쉽고 적응력이 강하지만 추세 시장에서 좋지 않은 성능을 발휘할 수 있으며 매개 변수 선택에 의존한다.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('Mean Reversion with Tight Stop Loss', overlay=true)
// Define parameters
rsiLength = 14
rsiThresholdBuy = 30
rsiThresholdSell = 70
smaPeriod = 20
stopLossPercentage = 0.5 // 0.5% stop loss
profitTargetPercentage = 1 // 1% profit target
// Calculate indicators
rsi = ta.rsi(close, rsiLength)
sma = ta.sma(close, smaPeriod)
// Entry conditions
buySignal = rsi < rsiThresholdBuy and close < sma
sellSignal = rsi > rsiThresholdSell and close > sma
// Exit conditions
if strategy.position_size > 0
stopLoss = strategy.position_avg_price * (1 - stopLossPercentage / 100)
takeProfit = strategy.position_avg_price * (1 + profitTargetPercentage / 100)
if close <= stopLoss or close >= takeProfit
strategy.close('Exit', comment='Stop Loss / Take Profit')
// Execute trades
if buySignal
strategy.entry('Buy', strategy.long)
if sellSignal
strategy.entry('Sell', strategy.short)