빠른 RSI 반전 거래 전략

저자:차오장, 날짜: 2024-03-01 11:55:56
태그:

img

전반적인 설명

빠른 RSI 역전 거래 전략은 빠른 RSI 지표, 촛불 몸 필터, 최소 / 최대 가격 필터 및 SMA 필터를 결합하여 낮은 위험 역전 거래를위한 트렌드 역전 지점을 결정하여 거래 신호를 생성합니다. 전략은 단기 역전 기회를 포착하는 것을 목표로합니다.

전략 논리

이 전략은 주로 다음의 평가 지표에 기초합니다.

  1. 빠른 RSI 지표: RMA 함수를 사용하여 RSI를 계산하여 과잉 구매 / 과잉 판매 신호를 더 빨리 파악하기 위해 더 민감하게 만듭니다.

  2. 촛불체 필터: 낮은 변동성 상황을 필터링하기 위해 촛불체 크기가 EMA 체 평균의 1/5을 초과해야 합니다.

  3. 최소/최대 가격 필터: 가격이 새로운 최고 또는 새로운 최저에 도달하면 추세 반전을 확인합니다.

  4. SMA 필터: 추가 확인을 위해 SMA 라인을 깨는 가격이 필요합니다.

상거래 신호는 위의 여러 조건이 동시에 발생하면 생성됩니다. 구체적인 논리는 다음과 같습니다.

긴 엔트리: 과잉 판매 수준 이하의 빠른 RSI 그리고 EMA 몸의 1/5 이상의 촛불 몸

짧은 엔트리: 과잉 매수 수준 이상의 빠른 RSI 그리고 EMA 몸의 1/5 이상의 촛불 몸 그리고 최대 가격 브레이크오웃 그리고 SMA 아래의 가격 크로스

출구: 빠른 RSI 정상 범위로 돌아갑니다.

장점

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 단기 반전에서 발생하는 변동성을 포착합니다.
  2. 빠른 RSI 지표가 민감합니다.
  3. 여러 필터로 잘못된 신호를 줄입니다.
  4. 통제 가능한 위험, 소액 사용

위험 과 최적화

이 전략은 또한 몇 가지 위험을 안고 있습니다.

  1. 실패한 환전 위험
  2. 제한된 최적화 공간

다음을 통해 더 최적화 할 수 있습니다.

  1. 거래량 필터를 추가합니다
  2. 스톱 손실을 실행
  3. 매개 변수 조합을 최적화

결론

전체적으로 이것은 저 위험 단기 평균 역전 거래 전략입니다. 빠른 RSI로 거래 신호를 식별하고 잘못된 신호를 줄이기 위해 여러 필터를 사용하여 제어 가능한 리스크 역전 거래를 달성합니다. 전략은 더 이상 최적화 될 수 있으며 큰 잠재력을 가지고 있습니다.


/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-26 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=3
strategy(title = "Noro's Fast RSI Strategy v1.4", shorttitle = "Fast RSI str 1.4", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 5)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usersi = input(true, defval = true, title = "Use Fast RSI Strategy")
usemm = input(true, defval = true, title = "Use Min/Max Strategy")
usesma = input(true, defval = true, title = "Use SMA Filter")
smaperiod = input(20, defval = 20, minval = 2, maxval = 1000, title = "SMA Filter Period")
rsiperiod = input(7, defval = 7, minval = 2, maxval = 50, title = "RSI Period")
limit = input(30, defval = 30, minval = 1, maxval = 100, title = "RSI limit")
rsisrc = input(close, defval = close, title = "RSI Price")
rsibars = input(1, defval = 1, minval = 1, maxval = 20, title = "RSI Bars")
mmbars = input(1, defval = 1, minval = 1, maxval = 5, title = "Min/Max Bars")
showsma = input(false, defval = false, title = "Show SMA Filter")
showarr = input(false, defval = false, title = "Show Arrows")
fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Fast RSI
fastup = rma(max(change(rsisrc), 0), rsiperiod)
fastdown = rma(-min(change(rsisrc), 0), rsiperiod)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//Limits
bar = close > open ? 1 : close < open ? -1 : 0
uplimit = 100 - limit
dnlimit = limit

//RSI Bars
upsignal = fastrsi > uplimit ? 1 : 0
dnsignal = fastrsi < dnlimit ? 1 : 0
uprsi = sma(upsignal, rsibars) == 1
dnrsi = sma(dnsignal, rsibars) == 1

//Body
body = abs(close - open)
emabody = ema(body, 30)

//MinMax Bars
min = min(close, open)
max = max(close, open)
minsignal = min < min[1] and bar == -1 and bar[1] == -1 ? 1 : 0
maxsignal = max > max[1] and bar == 1 and bar[1] == 1 ? 1 : 0
mins = sma(minsignal, mmbars) == 1
maxs = sma(maxsignal, mmbars) == 1

//SMA Filter
sma = sma(close, smaperiod)
colorsma = showsma ? blue : na
plot(sma, color = colorsma, linewidth = 3)

//Signals
up1 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and dnrsi and body > emabody / 5 and usersi
dn1 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and uprsi and body > emabody / 5 and usersi
up2 = mins and (close > sma or usesma == false) and usemm
dn2 = maxs and (close < sma or usesma == false) and usemm 
exit = ((strategy.position_size > 0 and fastrsi > dnlimit and bar == 1) or (strategy.position_size < 0 and fastrsi < uplimit and bar == -1)) and body > emabody / 2

//Arrows
col = exit ? black : up1 or dn1 ? blue : up2 or dn2 ? red : na
needup = up1 or up2
needdn = dn1 or dn2
needexitup = exit and strategy.position_size < 0
needexitdn = exit and strategy.position_size > 0
plotarrow(showarr and needup ? 1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needdn ? -1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needexitup ? 1 : na, colorup = black, colordown = black, transp = 0)
plotarrow(showarr and needexitdn ? -1 : na, colorup = black, colordown = black, transp = 0)

//Trading
if up1 or up2
    strategy.entry("Long", strategy.long, needlong == false ? 0 : na)

if dn1 or dn2
    strategy.entry("Short", strategy.short, needshort == false ? 0 : na)
    
if time > timestamp(toyear, tomonth, today, 00, 00) or exit
    strategy.close_all()

더 많은