
이 전략은 양축 시간축 RSI 반전이라고 불리며, 상대 강도 지수 ((RSI) 를 기반으로 한 정량 거래 전략이다. 이 전략은 두 개의 다른 주기 RSI를 구매 및 판매 신호로 사용하여, 낮은 구매 및 높은 판매를 달성하고, 주식 가격 반전의 거래 기회를 획득한다.
이 전략은 빠른 주기를 이용하여 ((전설 55일) RSI와 느린 주기를 이용하여 ((전설 126일) RSI를 사용하여 거래 신호를 구성한다. 빠른 주기를 RSI 위에 두고 느린 주기를 RSI를 통과할 때 구매 신호를 생성하고, 반대로 빠른 주기를 RSI 아래에 두고 느린 주기를 RSI를 통과할 때 판매 신호를 생성한다. 이렇게 두 개의 다른 시간대 사이의 가격 동력의 상대적으로 강한 것을 비교하여 단기 및 장기적인 트렌드 반전 기회를 발견한다.
신호가 들어간 후, 전략은 중지 중지 손실을 설정합니다. 중지 중지 값은 입력 가격의 0.9배이며, 중지 손실 값은 입력 가격의 3%입니다. 역전 신호가 다시 발생하면 현재 위치를 평행합니다.
이 전략은 쌍시계 RSI 역전 (RSI Reversal) 을 비교하여 빠른 주기와 느린 주기의 두 RSI를 교차하여 거래 신호로 삼고, 단기 가격 역전 기회를 잡는 것을 목표로 한다. 동시에 스톱 손실 규칙을 설정하여 위험을 회피한다. 이것은 지표의 다중 시간 축 비교를 사용하여 가격 역전 거래를 실현하는 전형적인 전략이다. 최적화 공간은 파라미터 조정과 위험 관리 규칙을 최적화한다.
/*backtest
start: 2022-11-29 00:00:00
end: 2023-12-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy(title="Relative Strength Index", shorttitle="RSI")
slen = input(55, title="Short length")
llen = input(126, title="Long length")
sup = ema(max(change(close), 0), slen)
sdown = ema(-min(change(close), 0), slen)
rsi1 = sdown == 0 ? 100 : sup == 0 ? 0 : 100 - (100 / (1 + sup / sdown))
lup = ema(max(change(close), 0), llen)
ldown = ema(-min(change(close), 0), llen)
rsi2 = ldown == 0 ? 100 : lup == 0 ? 0 : 100 - (100 / (1 + lup / ldown))
ob = input(55, title="Overbought")
os = input(45, title="Oversold")
tp = input(.9, title="Take profit level %")*.01
sl = input(3, title="Stoploss level %")*.01
mid = avg(ob,os)
plot (mid, color=#4f4f4f, transp=0)
hline (ob, color=#4f4f4f)
hline (os, color=#4f4f4f)
long = crossover(rsi1,rsi2)
short = crossunder(rsi1,rsi2)
vall = valuewhen(long,close,0)
lexit1 = high>=(vall*tp)+vall
lexit2 = low<=vall-(vall*sl)
vals = valuewhen(short,close,0)
sexit1 = low<=vals - (vals*tp)
sexit2 = high>=vals + (vals*sl)
bgcolor (color=long?lime:na,transp=50)
bgcolor (color=short?red:na, transp=50)
strategy.entry("Long", strategy.long, when=long)
strategy.close("Long", when=lexit1)
strategy.close("Long", when=lexit2)
strategy.close("Long", when=short)
strategy.entry("Short", strategy.short, when=short)
strategy.close("Short", when=sexit1)
strategy.close("Short", when=sexit2)
strategy.close("Short", when=long)
plot (rsi1, color=orange, transp=0,linewidth=1, title="Short period RSI")
plot (rsi2, color=aqua , transp=0,linewidth=1, title="Long period RSI")