RSI V형 패턴 스윙 거래 전략

저자:차오장, 날짜: 2024-01-12 13:52:55
태그:

img

전반적인 설명

이 전략은 신뢰할 수 있는 단기 수익성있는 거래 전략을 개발하기 위해 EMA 필터와 결합하여 RSI 지표에 의해 형성된 V 모양 패턴을 기반으로합니다. 그것은 단기적으로 수익을 창출하기 위해 RSI의 V 모양 신호를 통해 정확하게 길게 이동하여 가격이 과판 될 때 리바운드 기회를 포착합니다.

전략 논리

  1. 장기 상승 추세를 판단하기 위해 50일 EMA 이상의 20일 EMA를 사용하십시오.
  2. RSI는 V 모양의 패턴을 형성하여 과판된 리바운드 기회를 나타냅니다.
    • 이전 바의 낮은 값은 이전 2 바의 낮은 값보다 낮습니다
    • 현재 바의 RSI는 이전 2 바의 RSI보다 높습니다.
  3. RSI는 V 모양 패턴의 완료 신호로 30을 넘습니다.
  4. 엔트리 가격보다 8% 낮은 스톱 로스를 설정
  5. RSI가 70을 넘으면 포지션을 닫기 시작하고 엔트리 가격으로 스톱 로스로 이동합니다.
  6. RSI가 90을 넘으면 포지션 3/4을 닫습니다.
  7. RSI가 10 이하로 떨어지면 모든 포지션을 닫습니다.

이점 분석

  1. EMA를 사용하여 전체 시장 방향을 판단하고 트렌드에 반대하는 거래를 피하십시오.
  2. RSI V형 패턴은 과판된 경우 평균 역전 기회를 포착합니다.
  3. 리스크를 통제하기 위한 여러 스톱 로스 메커니즘

위험 분석

  1. 강한 하락 추세는 막히지 않는 손실을 초래할 수 있습니다.
  2. RSI V형 신호는 잘못된 신호를 줄 수 있으며 불필요한 손실로 이어질 수 있습니다.

최적화 방향

  1. 더 신뢰할 수 있는 V 모양 패턴을 찾기 위해 RSI 매개 변수를 최적화
  2. 반전 신호의 신뢰성을 높이기 위해 다른 지표를 포함
  3. 스톱 로스 전략을 정비하고 과도한 공격성을 방지하고 적절한 스톱 로스 사이의 균형을 유지합니다.

요약

이 전략은 EMA 필터와 RSI V 모양 패턴 판단을 통합하여 신뢰할 수 있는 단기 거래 전략을 형성합니다. 과잉 판매 시 리바운드 기회를 효과적으로 포착 할 수 있습니다. 매개 변수 및 모델에 대한 지속적인 최적화, 스톱 로스 메커니즘 개선으로이 전략은 안정성과 수익성을 더욱 향상시킬 수 있습니다. 양 거래자에게 수익성있는 스윙 거래의 문을 여깁니다.


/*backtest
start: 2023-12-12 00:00:00
end: 2024-01-11 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mohanee

//@version=4
//strategy("RSI V Pattern", overlay=true)
strategy(title="RSI V Pattern", overlay=false )

//Strategy Rules
//ema20 is above ema50  --- candles are colored  green on the chart
//RSI value sharply coming up which makes a V shape ,  colored in yellow on the chart
//RSI V pattern should occur from below 30    

len = input(title="RSI Period", minval=1, defval=5)
stopLoss = input(title="Stop Loss %", minval=1, defval=8)

myRsi = rsi(close,len)

longEmaVal=ema(close,50)
shortEmaVal=ema(close,20)

//plot emas 
//plot(longEmaVal, title="Long EMA" ,linewidth=2, color=color.orange, trackprice=true)
//plot(shortEmaVal, title="Short EMA" ,linewidth=2, color=color.green, trackprice=true)


longCondition =  ema(close,20)>ema(close,50)   and (low[1]<low[2] and  low[1]<low[3]) and (myRsi>myRsi[1] and myRsi>myRsi[2] ) and crossover(myRsi,30) //  (   and myRsi<60)  

//(myRsi<60 and myRsi>30)  and myRsi>myRsi[1] and (myRsi[1]<myRsi[2]  or  myRsi[1]<myRsi[3]) and (myRsi[2]<30)  and (myRsi[3]<30 and myRsi[4]>=30)



barcolor(shortEmaVal>longEmaVal?color.green:color.red)
//longCondition = crossover(sma(close, 14), sma(close, 28))
barcolor(longCondition?color.yellow:na)
strategy.entry("RSI_V_LE", strategy.long, when=longCondition )
//stoploss value at 10%
stopLossValue=strategy.position_avg_price -  (strategy.position_avg_price*stopLoss/100) 
//stopLossValue=valuewhen(longCondition,low,3)


//takeprofit at RSI highest  reading
//at RSI75 move the stopLoss to entry price
moveStopLossUp=strategy.position_size>0 and crossunder(myRsi,70)
barcolor(moveStopLossUp?color.blue:na)
stopLossValue:=crossover(myRsi,70) ? strategy.position_avg_price:stopLossValue

//stopLossValue:=moveStopLossUp?strategy.position_avg_price:stopLossValue
rsiPlotColor=longCondition ?color.yellow:color.purple
rsiPlotColor:= moveStopLossUp ?color.blue:rsiPlotColor
plot(myRsi, title="RSI", linewidth=2, color=rsiPlotColor)
//longCondition?color.yellow:#8D1699)
hline(50, title="Middle Line", linestyle=hline.style_dotted)
obLevel = hline(75, title="Overbought", linestyle=hline.style_dotted)
osLevel = hline(25, title="Oversold", linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=#9915FF, transp=90)


    
//when RSI crossing down 70 , close 1/2 position and move stop loss to average entry price
strategy.close("RSI_V_LE",  qty=strategy.position_size*1/2, when=strategy.position_size>0 and crossunder(myRsi,70))

//when RSI reaches high reading 90 and crossing down close 3/4 position
strategy.close("RSI_V_LE",  qty=strategy.position_size*3/4, when=strategy.position_size>0 and crossunder(myRsi,90))



//close everything when Rsi goes down below to 10 or stoploss hit  
//just keeping RSI cross below 10 , can work as stop loss , which also keeps you long in the trade ... however sharp declines could  make large loss
//so I combine RSI goes below 10 OR stoploss hit  , whichever comes first - whole posiition closed
longCloseCondition=crossunder(myRsi,10)  or close<stopLossValue
strategy.close("RSI_V_LE", qty=strategy.position_size,when=longCloseCondition )



더 많은