RSI 다이버전스 트레이딩 전략


생성 날짜: 2024-01-23 11:08:48 마지막으로 수정됨: 2024-01-23 11:08:48
복사: 0 클릭수: 655
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

RSI 다이버전스 트레이딩 전략

개요

RSI 지표의 불일치 거래 전략은 RSI 지표와 가격의 불일치를 분석하여 가치 불일치의 기회를 발견하고, 불일치가 발생하면 더 많은 공백을 낸다.

전략 원칙

이 전략은 RSI 지표와 가격이 이탈했을 때 가치의 차이를 기반으로한다. RSI 지표는 강한 약점을 반영하고, 가격은 수요와 공급 관계를 반영한다. 둘이 충돌했을 때, 시장이 잘못된 가격이 있음을 나타냅니다.

구체적으로, RSI가 더 높은 하락점을 형성하고 가격이 더 낮은 하락점을 형성하는 것이 일반적인 다중의 차이입니다. 이것은 시장이 표면적으로 하락했지만 실제로는 축적된 반전의 징후가 있음을 의미합니다. RSI가 50 분기선을 상향으로 돌파 할 때, 반전의 기회를 잡을 수 있습니다.

일반적인 공백은 반대로 RSI가 더 낮은 고점을 형성하고 가격이 더 높은 고점을 형성한다. 이것은 시장의 표면이 낙관적이지만 실제로는 내부적으로 약한 징후를 나타냅니다. RSI가 가격에서 벗어나 50 분기선을 아래로 돌파 할 때, 적자를 얻을 수 있습니다.

또한, 숨겨진 다목적 차이와 공백 차이도 있다. 이 경우 RSI와 가격의 관계는 일반적인 차이와 반대이지만, 원칙은 동일하며, 이윤도 얻을 수 있다.

전략적 이점

  1. 가치의 차이를 포착하고 시장의 가격 오류를 발견합니다.
  2. 지표와 가격의 오차를 결합하여 승률을 높이는 방법
  3. 다양한 의견 차이를 구분하고, 더 많은 기회를 포괄합니다.

위험 분석

  1. 특정 시장 상황에서도 허위 의견이 발생할 수 있으며, 이를 식별할 필요가 있습니다.
  2. 50의 경계를 넘기는 것은 그다지 큰 승률이 아닙니다. 적절히 최적화 할 수 있습니다.
  3. 다공방향을 잘못 선택하면 큰 손실이 발생할 수 있습니다.

최적화 방향

  1. RSI 파라미터를 최적화하여 지표 예측 정확도를 향상시킵니다.
  2. 다른 지표와 함께 판단의 신호를 다
  3. 더 많은 상장과 이익의 위험 비율을 평가하고 단독 손실을 제어합니다.

요약하다

RSI 지표 격차 전략은 가치와 가격의 이탈을 분석하여 시장 오류 가격을 발견하는 전형적인 통계적 중개 전략이다. 이 전략의 장점은 트렌드 반전 기회를 제때 발견하는 데 있으며, 위험은 격차를 식별하는 정확성에 있다. 지속적인 최적화를 통해 실전에서 안정적인 수익을 얻을 수 있다.

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

//@version=5
strategy(title="Divergence Indicator")
len = input.int(title="RSI Period", minval=1, defval=14)
src = input(title="RSI Source", defval=close)
lbR = input(title="Pivot Lookback Right", defval=5)
lbL = input(title="Pivot Lookback Left", defval=5)
rangeUpper = input(title="Max of Lookback Range", defval=60)
rangeLower = input(title="Min of Lookback Range", defval=5)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=true)
bearColor = color.red
bullColor = color.green
hiddenBullColor = color.new(color.green, 80)
hiddenBearColor = color.new(color.red, 80)
textColor = color.white
noneColor = color.new(color.white, 100)
osc = ta.rsi(src, len)

plot(osc, title="RSI", linewidth=2, color=#2962FF)
hline(50, title="Middle Line", color=#787B86, linestyle=hline.style_dotted)
obLevel = hline(70, title="Overbought", color=#787B86, linestyle=hline.style_dotted)
osLevel = hline(30, title="Oversold", color=#787B86, linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=color.rgb(33, 150, 243, 90))

plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
	bars = ta.barssince(cond == true)
	rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low

oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Lower Low

priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1) 
// bull : 상승 Condition : 조건
bullCond = plotBull and priceLL and oscHL and plFound // 상승다이버전스?
strategy.entry("상승 다이버전스 진입", strategy.long, when = bullCond)
strategy.close("상승 다이버전스 진입", when = ta.crossover(osc, 50)) 
plot(
     plFound ? osc[lbR] : na,
     offset=-lbR,
     title="Regular Bullish",
     linewidth=2,
     color=(bullCond ? bullColor : noneColor)
     )

plotshape(
	 bullCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bullish Label",
	 text=" Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor
	 )

//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low

oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Higher Low

priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound
// strategy.entry("히든 상승 다이버전스 진입", strategy.long, when = hiddenBullCond)
// strategy.close("히든 상승 다이버전스 진입", when = ta.crossover(osc, 50))
plot(
	 plFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish",
	 linewidth=2,
	 color=(hiddenBullCond ? hiddenBullColor : noneColor)
	 )

plotshape(
	 hiddenBullCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish Label",
	 text=" H Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor
	 )

//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High

oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Higher High

priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
// bear : 하락 
bearCond = plotBear and priceHH and oscLH and phFound
// strategy.entry("하락 다이버전스 진입", strategy.short, when = bearCond)
// strategy.close("하락 다이버전스 진입", when = ta.crossunder(osc, 50)) 
plot(
	 phFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish",
	 linewidth=2,
	 color=(bearCond ? bearColor : noneColor)
	 )

plotshape(
	 bearCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish Label",
	 text=" Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor
	 )

//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High

oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Lower High

priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)

hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound
// strategy.entry("히든 하락 다이버전스 진입", strategy.short, when = hiddenBearCond)
// strategy.close("히든 하락 다이버전스 진입", when = ta.crossunder(osc, 50)) 
plot(
	 phFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish",
	 linewidth=2,
	 color=(hiddenBearCond ? hiddenBearColor : noneColor)
	 )

plotshape(
	 hiddenBearCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish Label",
	 text=" H Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor
	 )