두 배 빠른 RSI 돌파구 전략

저자:차오장, 날짜: 2023-11-07 16:56:39
태그:

img

전반적인 설명

이 전략은 더 정확한 입출 신호를 생성하기 위해 여러 RSI 지표를 사용하여 가격 돌파구를 구현합니다.

전략 논리

이 전략은 두 개의 RSI 매개 변수를 설정합니다. 하나는 7의 기간과 25의 한계, 다른 하나는 14의 기간과 25의 한계입니다. 가격이 RSI 한계 중 하나를 넘으면 긴 또는 짧은 주문이 실행됩니다.

이 전략은 먼저 두 개의 RSI 지표의 값을 계산하고, 그 다음 가격이 RSI 상위 또는 하위 한계를 넘을 수 있는지 판단합니다. 상위 한계를 넘으면 긴 신호가 생성됩니다. 하위 한계를 넘으면 짧은 신호가 생성됩니다.

이미 위치가 있는 경우, 현재 RSI가 정상 범위 내에 있는지 판단을 계속합니다. RSI가 정상화되고 몸체가 이동 평균의 절반을 깨면 출구 신호가 생성됩니다.

이 전략은 또한 마틴게일 시스템을 사용합니다. 주문 크기는 손실 후 두 배로 증가합니다.

이점 분석

  • 두 개의 RSI 인디케이터를 사용하면 돌파 신호를 더 잘 판단하고 잘못된 신호를 피할 수 있습니다.

  • 또한 체제 돌파구를 확인하면 통합 과정에서 잘못된 거래를 피할 수 있습니다.

  • 마틴게일은 손실 후 손해를 빨리 막는 데 도움이 됩니다.

  • 커스터마이징 가능한 RSI 매개 변수는 진입 기회를 최적화합니다.

  • 주요 사건의 영향을 피하기 위해 거래 세션은 제한 될 수 있습니다.

위험 분석

  • 이중 RSI는 잘못된 돌파구를 완전히 피할 수 없습니다.

  • 마틴게일 손실 후 포지션을 늘려서 폭발할 위험이 있습니다.

  • 거래 비용은 고려되지 않습니다.

  • 최적화 가능한 매개 변수들이 너무 많아서 최적의 조합을 찾기 위해 많은 테스트가 필요합니다.

손실을 제한하기 위해 스톱 로스를 설정할 수 있습니다. RSI 매개 변수를 최적화할 수 있습니다. 비용 고려를 추가할 수 있습니다. 돌파구 기준을 완화할 수 있습니다.

최적화 방향

  • 최대 손실을 제한하기 위해 Stop Loss를 추가합니다.

  • 잘못된 신호를 줄이기 위해 RSI 매개 변수를 최적화합니다.

  • 과잉 거래를 방지하기 위해 거래 비용 영향을 고려하십시오.

  • 더 많은 기회를 얻기 위해 신체의 돌파구 기준을 느슨하게하십시오.

  • 더 많은 필터를 추가해 갇히지 않도록 해

요약

이 전략은 가격 돌파구를 결정하기 위해 이중 RSI를 사용하며, 윙사 (whipsaws) 를 피하기 위해 몸 돌파구 필터를 추가합니다. 또한 손실을 빠르게 줄이기 위해 마틴게일을 사용합니다. 더 정확한 신호를 위해 매개 변수를 최적화하고 필터를 추가하여 전략을 개선할 수 있습니다. 손실을 제한하는 데 위험 관리는 중요합니다. 전반적으로이 전략은 높은 효율성 거래에 적합한 비교적 안정적인 돌파구 시스템을 제공합니다.


/*backtest
start: 2023-10-30 00:00:00
end: 2023-11-06 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's Fast RSI Strategy v2.0", shorttitle = "Fast RSI str 2.0", overlay = true)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usemar = input(false, defval = false, title = "Use Martingale")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
usersi1 = input(true, defval = true, title = "Use RSI #1")
rsiperiod1 = input(7, defval = 7, minval = 2, maxval = 50, title = "#1 RSI Period")
rsilimit1 = input(25, defval = 25, minval = 1, maxval = 100, title = "#1 RSI limit")
usersi2 = input(true, defval = true, title = "Use RSI #2")
rsiperiod2 = input(14, defval = 14, minval = 2, maxval = 50, title = "#2 RSI Period")
rsilimit2 = input(25, defval = 25, minval = 1, maxval = 100, title = "#2 RSI limit")
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")

//RSI #1
uprsi1 = rma(max(change(close), 0), rsiperiod1)
dnrsi1 = rma(-min(change(close), 0), rsiperiod1)
rsi1 = dnrsi1 == 0 ? 100 : uprsi1 == 0 ? 0 : 100 - (100 / (1 + uprsi1 / dnrsi1))
uplimit1 = 100 - rsilimit1
dnlimit1 = rsilimit1

//RSI #2
uprsi2 = rma(max(change(close), 0), rsiperiod2)
dnrsi2 = rma(-min(change(close), 0), rsiperiod2)
rsi2 = dnrsi2 == 0 ? 100 : uprsi2 == 0 ? 0 : 100 - (100 / (1 + uprsi2 / dnrsi2))
uplimit2 = 100 - rsilimit2
dnlimit2 = rsilimit2

//Body
body = abs(close - open)
abody = sma(body, 10)

//Signals
bar = close > open ? 1 : close < open ? -1 : 0
up1 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and rsi1 < dnlimit1 and body > abody / 5 and usersi1
dn1 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and rsi1 > uplimit1 and body > abody / 5 and usersi1
up2 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and rsi2 < dnlimit2 and body > abody / 5 and usersi2
dn2 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and rsi2 > uplimit2 and body > abody / 5 and usersi2
norma = rsi1 > dnlimit1 and rsi1 < uplimit1 and rsi2 > dnlimit2 and rsi2 < uplimit2
exit = (((strategy.position_size > 0 and bar == 1 and norma) or (strategy.position_size < 0 and bar == -1 and norma)) and body > abody / 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
profit = exit ? ((strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price)) ? 1 : -1 : profit[1]
mult = usemar ? exit ? profit == -1 ? mult[1] * 2 : 1 : mult[1] : 1
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 * mult : lot[1]

if up1 or up2
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot)

if dn1 or dn2
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot)
    
if  exit
    strategy.close_all()

더 많은