
이 전략은 평준화 후 상대적으로 강한 지수 ((RSI) 를 기반으로 구매 및 판매 신호를 결정하기 위해, 비교적 전형적인 추세 추적 전략에 속한다. 특정 기간 동안 주식 가격의 폭이 떨어지는 것을 계산함으로써, 투자자가 시장이 과매매 또는 과매매 상태에 있는지 판단하여 투자 결정을 내릴 수 있도록 도와줍니다.
이 전략의 핵심은 평평한 RSI 지표의 설정에 있습니다. RSI 지표는 주식 가격의 초매를 반영 할 수 있습니다. 그러나 원시 RSI 지표는 가격과 함께 급격하게 변동 할 수 있으며 거래 신호를 생성하는 데 도움이되지 않습니다.
이 전략은 RSI 지표를 계산하고 부드럽게 처리하여 합리적인 오버 바이 오버 셀 영역을 설정하여 비교적 명확한 구매 판매 신호를 생성합니다. 원시 RSI 전략에 비해 신호가 더 안정적이고 신뢰할 수있는 장점이 있습니다. 그러나 개선 할 수있는 여지가 있습니다.
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Smoothed RSI Strategy", overlay=true)
// Calculate the RSI
length = 5
rsiValue = ta.rsi(close, length)
// Smooth the RSI using a moving average
smoothedRsi = ta.sma(rsiValue, length)
// Define overbought and oversold thresholds
overbought = 80
oversold = 40
// Buy signal when RSI is in oversold zone
buyCondition = ta.crossover(smoothedRsi, oversold)
// Sell signal when RSI is in overbought zone
sellCondition = ta.crossunder(smoothedRsi, overbought)
// Plotting the smoothed RSI
// Plotting the smoothed RSI in a separate pane
plot(smoothedRsi, color=color.blue, title="Smoothed RSI", style=plot.style_line, linewidth=2)
//plot(smoothedRsi, color=color.blue, title="Smoothed RSI")
hline(overbought, "Overbought", color=color.red)
hline(oversold, "Oversold", color=color.green)
// Strategy logic for buying and selling
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.close("Buy")