빠른 RSI 지표 2차 돌파 전략


생성 날짜: 2023-11-07 16:56:39 마지막으로 수정됨: 2023-11-07 16:56:39
복사: 0 클릭수: 737
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

빠른 RSI 지표 2차 돌파 전략

개요

이 전략은 RSI 지표의 매개 변수를 여러 번 설정하여 가격의 여러 돌파구를 구현하여 더 정확한 입구 및 출구 신호를 구현합니다.

전략 원칙

이 전략은 두 개의 RSI 파라미터를 설정합니다. RSI 주기는 7로 제한되는 RSI 지표와 RSI 주기는 14로 제한되는 RSI 지표입니다.

전략은 먼저 두 개의 RSI 지표의 값을 계산한 다음 가격이 RSI의 상한 또는 하한을 뚫었는지 판단합니다. 상한을 뚫면 더 많은 신호를 생성하고, 하한을 뚫면 빈 신호를 생성합니다.

만약 이미 포지션을 보유하고 있다면, 현재 RSI가 정상 범위 안에 있는지 계속 판단할 것이다. RSI가 정상이고, 동시에 주체가 평균선 반을 뚫면, 탈퇴 신호가 발생한다.

이 전략은 또한 마틴겔 가저 시스템을 사용한다. 매번 손실을 입으면 다음 거래량이 두 배로 증가한다.

우위 분석

  • 두 개의 RSI 지표를 사용하여 돌파 신호를 더 정확하게 판단하여 가짜 돌파를 피할 수 있습니다.

  • 또한, 실물 침입을 확인하고, 흔들림 중에 잘못된 거래를 피하십시오.

  • 마틴게일 가설을 사용하면 손실 후 빠르게 손실을 막을 수 있습니다.

  • 사용자 정의 가능한 RSI 파라미터 포지션은 입학 기회를 최적화한다.

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

위험 분석

  • 이중 RSI 지표는 가짜 브레이크 현상을 완전히 피할 수 없습니다.

  • 마틴겔은 손실이 있을 때 더 큰 지점을 차지하고, 쉽게 지점을 파손할 수 있다.

  • 거래 비용의 영향을 고려하지 않습니다.

  • 최적화 가능한 파라미터는 많고, 최적의 파라미터 조합을 찾기 위해 많은 테스트가 필요합니다.

손실을 제한하기 위해 스톱을 설정할 수 있습니다. RSI 파라미터 포괄을 최적화합니다. 비용 고려 사항을 추가합니다.

전략 최적화 방향

  • 최대 손실을 제한할 수 있는 손해배상 장치에 가입하십시오.

  • RSI 변수 모음을 최적화하여 가짜 브레이크를 줄이기 위해 최적의 변수를 찾습니다.

  • 거래 비용의 영향을 고려하여 너무 자주 거래하는 것을 방지하십시오.

  • 기업들의 브레이크 판정을 허용하고, 더 많은 거래 기회를 제공합니다.

  • 더 많은 지표들을 필터링하여 을 피하십시오.

요약하다

이 전략은 쌍 RSI 지표를 사용하여 가격 돌파구를 판단하고, 실물 돌파구를 판단하여, 흔들리는 시장에서 피하는 것을 피한다. 동시에 마틴겔 가설을 적용하여 신속하게 중단한다. 이 전략은 파라미터를 최적화하고 더 많은 지표 필터를 추가함으로써 더 정확한 거래 신호를 얻을 수 있다. 그러나 손실을 확대하지 않도록 위험 관리에주의를 기울여야 한다.

전략 소스 코드
/*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()