
이 전략은 상대적 강도 지수 (RSI) 를 계산하여 시장의 잠재적 인 구매 및 판매 기회를 식별합니다. RSI 지표를 사용하여 가격이 추세에서 역행으로 전환 할 수있는 지점을 판단하여 역행 기회를 잡습니다. RSI가 오버 바이 또는 오버 셀 영역에서 역행 할 때 거래 신호가 발생합니다.
이 전략의 핵심 지표는 RSI이며, 이는 종결 가격 상승의 날 수와 가격 하락의 날 수의 비율을 나타내는 것으로, 자산이 과대 평가되거나 과소 평가되는지 판단하는 데 사용됩니다. RSI는 0에서 100 사이의 수로 표시되며, 수치가 높으면 시장의 강도가 상승하고, 수치가 낮으면 시장의 강도가 하락합니다.
전략은 먼저 RSI의 파라미터를 설정하고, 주기 길이를 포함합니다 (기본 14), 오버셀 영역의 하락값 (기본 70 및 30). 그리고 RSI 값을 종결 가격에 따라 계산합니다. RSI 상위에서 오버셀 영역의 하락값을 통과하면 구매 신호를 생성하고, RSI 아래에서 오버셀 영역의 하락값을 통과하면 판매 신호를 생성합니다.
전략은 동시에 RSI 지표 곡선과 경량선을 그리는다. 가격 차트에서 문자 및 그래픽으로 구매 및 판매 신호를 표시한다. 또한, 전략은 지난 거래 신호 이후의 가격 변화의 비율을 계산하고 그리며, 거래자가 신호 이후의 가격 움직임을 직관적으로 볼 수 있게 한다.
이 전략은 상대 강도 지수의 역전 거래 원칙을 통해 설계되었으며, 주요은 자산이 단기간에 명백한 과매매 과매매 현상이 나타나지 않는지 판단하여 후속 역전 기회를 잡습니다. 비율 변화를 계산하고 시각화 된 거래 팁과 함께 거래 결정을 보조 할 수 있습니다. RSI 파라미터는 사용자 정의가 가능하며 사용자는 개인 선호도에 따라 조정할 수 있습니다.
/*backtest
start: 2023-01-19 00:00:00
end: 2024-01-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Improved RSI Strategy", overlay=true)
// Define RSI parameters
rsiLength = input(14, title="RSI Length")
rsiOversold = input(30, title="Oversold Threshold")
rsiOverbought = input(70, title="Overbought Threshold")
// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)
// Define entry conditions
longCondition = ta.crossover(rsiValue, rsiOversold)
shortCondition = ta.crossunder(rsiValue, rsiOverbought)
// Plot RSI and thresholds
plot(rsiValue, title="RSI", color=color.blue)
hline(rsiOversold, title="Oversold Threshold", color=color.red)
hline(rsiOverbought, title="Overbought Threshold", color=color.green)
// Calculate percentage change since last signal
var float percentageChange = na
lastCloseValue = ta.valuewhen(longCondition or shortCondition, close, 1)
if longCondition or shortCondition
percentageChange := (close - lastCloseValue) / lastCloseValue * 100
plot(percentageChange, color=color.blue, style=plot.style_histogram, linewidth=1, title="% Change since last signal")
// Execute strategy
if longCondition
strategy.entry("RSI Long", strategy.long)
if shortCondition
strategy.entry("RSI Short", strategy.short)
// Plot shapes and text for buy/sell signals
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")