RSI 상승 및 하락 격차 거래 전략

저자:차오장, 날짜: 2024-01-15 12:09:54
태그:

img

전반적인 설명

이 전략은 시장의 상승과 하락 추세를 판단하고 RSI 지표의 분리를 계산하여 거래 결정을 내립니다. 구체적으로, RSI가 낮은 최저치를 형성하지만 가격이 높은 최저치를 형성할 때 숨겨진 상승 신호를 판단합니다. 그리고 RSI가 높은 최고치를 형성하지만 가격이 낮은 최고치를 형성 할 때 숨겨진 하락 신호를 판단합니다. 그 다음이 신호를 기반으로 시장의 잠재적 인 상승 또는 하락 추세를 결정하고 거래를합니다.

전략 논리

이 전략은 주로 RSI 지표의 상승 및 하락 분차 이론에 기반합니다. RSI와 가격이 역차이를 형성하면 시장의 잠재적 인 역전을 나타냅니다. 네 가지 특정 상황이 있습니다.

  1. 규칙적인 상승 신호: RSI는 높은 낮은 형태를 형성하고 가격이 낮은 낮은 형태를 나타냅니다. 구매력이 RSI를 밀어 올리는 것을 나타냅니다. 그러나 가격에 완전히 반영되지 않으며 상승 힘을 강화합니다.

  2. 숨겨진 상승 신호: RSI는 낮은 낮은 형태를 형성하고 가격이 높은 낮은 형태를 나타냅니다. 이것은 판매력이 RSI를 낮추는 것을 의미하지만 가격이 아닙니다.

  3. 규칙적인 하향 신호: RSI는 낮은 높은 것을 형성하고 가격이 높은 높은 것을 형성합니다. 이것은 판매력이 가격을 끌어올리는 것을 의미하지만 RSI는 그렇지 않으며 강화된 하향 힘을 나타냅니다.

  4. 숨겨진 하향 신호: RSI는 높은 높은 형태를 형성하고 가격이 낮은 높은 형태를 나타냅니다. 구매력이 RSI를 밀어 올리는 것을 나타냅니다.

위의 차이점을 바탕으로 시장의 잠재적 인 상승 또는 하락 추세와 구매/판매 힘의 강화를 판단하여 거래 전략을 수립합니다.

장점

  1. 시장의 잠재적 추세를 결정하기 위해 RSI의 상승 및 하락 분차 이론을 활용하십시오.
  2. 또한 가격 동작을 결합하여 확인하고 소음 신호를 피합니다.
  3. 시장의 급격한 변동 전에 중요한 신호를 포착할 수 있습니다.
  4. 상승 및 하락 신호를 시각화 표시를 구현, 쉽고 직관적으로 작동합니다.
  5. 다양한 시장 환경에 맞는 사용자 정의 가능한 매개 변수

위험성

  1. RSI와 가격 사이의 차이는 반드시 반전을 의미하지는 않을 수도 있습니다. 단지 범위 제한 행동일 수도 있습니다.
  2. 숨겨진 신호는 비교적 큰 소음을 가지고 있습니다. 잘못된 판단의 위험이 있습니다.
  3. 신호를 확인하기 위해 더 많은 지표나 기술적 분석 방법을 포함해야 합니다.
  4. 부적절한 매개 변수 설정도 판단에 영향을 줄 수 있습니다.

개선 방향

  1. 입시 신호를 결정하기 위해 MACD, KDJ 및 다른 지표를 RSI와 통합합니다.
  2. 트레이드당 손실을 줄이기 위해 스톱 로스 전략을 추가합니다.
  3. 더 적합한 RSI 기간을 찾는 것과 같은 매개 변수 설정을 최적화하십시오.
  4. 입력 신호를 캡처하는 정확성을 훈련하기 위해 기계 학습 알고리즘을 도입합니다.
  5. 신호 확인 지연을 줄이기 위해 실시간 코팅을 위해 웹소켓을 구현합니다.

요약

이 전략은 주로 RSI의 상승과 하락의 분리를 활용하여 가격 행동의 뒤에 있는 구매력과 판매력 사이의 상대적 힘 변화를 포착하여 시장의 잠재적 인 상승 또는 하락 추세를 결정합니다. 이 전략은 반전의 특정 예측 능력을 가지고 있습니다. 그러나 소음 신호의 위험도 있습니다. 매개 변수 최적화, 지표 조합, 기계 학습과 같은 방법은 전략의 안정성과 수익성을 더욱 향상시키는 데 도움이 될 수 있습니다.


/*backtest
start: 2024-01-07 00:00:00
end: 2024-01-14 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title="Divergence Indicator")
len = input.int(title="RSI Period", minval=1, defval=20)
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, 70)) 
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, 70))
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
	 )

더 많은