연중 조정에 따른 RSI 스윙 트레이딩 전략


생성 날짜: 2024-02-29 10:54:45 마지막으로 수정됨: 2024-02-29 10:54:45
복사: 0 클릭수: 592
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

연중 조정에 따른 RSI 스윙 트레이딩 전략

개요

이 전략은 연중 조정 기반의 RSI 흔들림 거래 전략으로, RSI 지표가 설정된 상하 궤도 사이의 흔들림 특성을 추적하여 RSI 지표가 상하 궤도에 닿을 때 거래 신호를 냅니다.

전략 원칙

  1. MA 평균선 길이, RSI 변수, 상승, 하락, 스톱 스톱 손실 변수, 거래 주기의 범위를 설정
  2. RSI를 계산합니다. RSI= (상승 평균) / (상승 평균 + 하락 평균)*100
  3. RSI 지표와 궤도를 그리기
  4. RSI 지표의 상위 하향 궤도는 다중 신호이고 하향 궤도는 공백 신호입니다
  5. OCO 상장을 개설
  6. 설정된 스톱 스톱 로직에 따라 스톱 스톱 및 스톱

전략적 강점 분석

  1. 일년 내 거래 주기를 설정함으로써, 일부 부적절한 외부 환경을 피할 수 있습니다.
  2. RSI 지표는 과매매를 효과적으로 반영할 수 있으며, 합리적인 범위를 설정하여 흔들림 거래를 통해 일부 소음을 필터링 할 수 있습니다.
  3. OCO는 스톱 스톱 로즈 설정과 결합하여 효율적인 위험 관리를 가능하게 한다.

전략적 위험 분석

  1. RSI의 비판적 판단의 정확성은 보장할 수 없으며, 잘못된 판단의 위험이 있을 수 있다.
  2. 일년 내 거래 주기를 잘못 설정하면 더 나은 거래 기회를 놓치거나 부적절한 거래 환경에 들어갈 수 있습니다.
  3. 너무 큰 스톱포인트는 큰 손실을 초래할 수 있고, 너무 작은 스톱포인트는 너무 작은 수익을 초래할 수 있다.

RSI 변수, 거래 주기의 시간 범위, 스톱 스톱 손실 비율 등을 조정하여 최적화 할 수 있습니다.

전략 최적화 방향

  1. 다른 시장의 다른 주기의 RSI 변수의 최적값을 테스트하는 방법
  2. 전체 시장의 주기적 법칙을 분석하여 1 년 동안의 최적의 거래 기간을 설정합니다.
  3. 재검토를 통해 합리적인 스톱스트로스 비율을 결정합니다.
  4. 거래 품종 선택과 포지션 규모를 확대
  5. 다른 더 나은 거래 기술이나 지표와 함께 최적화

요약하다

이 전략은 RSI 지표의 일 년 동안 지정된 주기에서의 흔들림 특성을 통해 트렌드를 추적하고 거래 위험을 효과적으로 제어합니다. 매개 변수 최적화 및 규칙 최적화를 통해 더 높은 전략 효과를 얻을 수 있습니다.

전략 소스 코드
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy(title = "Bitlinc MARSI Study AST",shorttitle="Bitlinc MARSI Study AST",default_qty_type = strategy.percent_of_equity, default_qty_value = 100,commission_type=strategy.commission.percent,commission_value=0.1,initial_capital=1000,currency="USD",pyramiding=0, calc_on_order_fills=false)

// === General Inputs ===
lengthofma = input(62, minval=1, title="Length of MA")
len = input(31, minval=1, title="Length")
upperband = input(89, minval=1, title='Upper Band for RSI')
lowerband = input(10, minval=1, title="Lower Band for RSI")
takeprofit =input(1.25, title="Take Profit Percent")
stoploss =input(.04, title ="Stop Loss Percent")
monthfrom =input(8, title = "Month Start")
monthuntil =input(12, title = "Month End")
dayfrom=input(1, title= "Day Start")
dayuntil=input(31, title= "Day End")

// === Innput Backtest Range ===
//FromMonth = input(defval = 9, title = "From Month", minval = 1, maxval = 12)
//FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
//FromYear  = input(defval = 2018, title = "From Year", minval = 2017)
//ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
//ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
//ToYear    = input(defval = 9999, title = "To Year", minval = 2017)

// === Create RSI ===
src=sma(close,lengthofma)
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot(rsi,linewidth = 2, color=purple)

// === Plot Bands ===
band1 = hline(upperband)
band0 = hline(lowerband)
fill(band1, band0, color=blue, transp=95)

// === Entry and Exit Methods ===
longCond =  crossover(rsi,lowerband)
shortCond =  crossunder(rsi,upperband)

// === Long Entry Logic ===
if (  longCond ) 
    strategy.entry("LONG", strategy.long, stop=close, oca_name="TREND", comment="LONG")
else
    strategy.cancel(id="LONG")

// === Short Entry Logic ===    
if ( shortCond   ) 
    strategy.entry("SHORT", strategy.short,stop=close, oca_name="TREND",  comment="SHORT")
else
    strategy.cancel(id="SHORT")

// === Take Profit and Stop Loss Logic ===
//strategy.exit("Take Profit LONG", "LONG", profit = close * takeprofit / syminfo.mintick, loss = close * stoploss / syminfo.mintick)
//strategy.exit("Take Profit SHORT", "SHORT", profit = close * takeprofit / syminfo.mintick, loss = close * stoploss / syminfo.mintick)
strategy.exit("LONG TAKE PROFIT", "LONG", profit = close * takeprofit / syminfo.mintick)
strategy.exit("SHORT STOP LOSS", "SHORT", profit = close * takeprofit / syminfo.mintick)
strategy.exit("LONG STOP LOSS", "LONG", loss = close * stoploss / syminfo.mintick)
strategy.exit("SHORT STOP LOSS", "SHORT", loss = close * stoploss / syminfo.mintick)