이중 전략: RSI와 스토카스틱 오시레이터를 결합

저자:차오장, 날짜: 2023-10-07 16:19:30
태그:

전반적인 설명

이 전략은 상대적 강도 지수 (RSI) 와 스토카스틱 오시레이터를 결합하여 과잉 구매 및 과잉 판매 시장 조건을 더 정확하게 식별하기 위한 이중 전략을 형성하여 더 신뢰할 수있는 거래 신호를 생성합니다.

어떻게 작동 합니까?

이 전략의 RSI는 14의 기간을 가지고 있으며, 70의 과잉 구매 임계와 30의 과잉 판매 임계로 스토카스틱 오시레이터의 %K 라인은 3 기간 SMA를 사용하고, 그 %D 라인은 %K의 3 기간 SMA입니다. %K가 %D를 넘을 때 상승 크로스오버가 발생하고, %K가 %D를 넘을 때 하락 크로스오버가 발생합니다.

거래 신호는 다음의 조합된 지표에 기초하여 생성됩니다.

  1. 스토카스틱에서 올림 크로스오버가 발생하고 RSI가 70을 넘으면, 오버구입 신호가 생성됩니다.

  2. 스토카스틱에서 하향적 크로스오버가 발생하고 RSI가 30보다 낮으면, 오버셀드 신호가 생성됩니다.

이 이중 전략은 RSI의 강점을 활용하여 과잉 구매/ 과잉 판매 수준을 파악하고 있으며, 스토카스틱의 트렌드 추적 기능을 사용하여 잘못된 신호를 필터링하여 더 신뢰할 수 있는 거래 항목을 만듭니다.

장점

이 두 가지 전략의 가장 큰 장점은 잘못된 신호가 크게 감소하고 신뢰성이 향상된다는 것입니다.

RSI 단독으로 과도한 잘못된 신호를 생성 할 수 있습니다. 이것은 RSI가 트렌드 방향을 고려하지 않고 가격 과잉 확장 수준을 반영하기 때문입니다. 따라서 독립적인 RSI 신호는 신뢰할 수 없습니다.

반면 스토카스틱 오시레이터는 트렌드 방향을 파악할 수 있습니다. 상승 크로스오버는 상승 동력이 지속될 수 있음을 암시하며, 과잉 구매 RSI 신호를 더 신뢰할 수 있습니다.

반대로, 하향 크로스오버는 임박한 트렌드 반전을 암시합니다. 과잉 판매 RSI 신호는이 경우 잘못된 신호일 수 있습니다.

따라서, RSI와 스토카스틱을 결합하면 과잉 확장 수준과 트렌드 방향성을 더 잘 식별할 수 있으며, 신뢰할 수 없는 신호를 필터링하고 높은 확률의 전환점을 찾을 수 있습니다.

위험성

이 전략을 사용 할 때 고려해야 할 위험도 있습니다.

  1. 이중 지표 접근법은 유효한 신호를 필터링하여 놓친 거래 기회를 유발할 수 있습니다.

  2. RSI 기간과 스토카스틱 평평화와 같은 매개 변수들의 정밀한 조정은 핵심입니다. 그렇지 않으면 신호 정확도가 손상될 수 있습니다.

  3. 가짜 파장을 피하기 위해 시그널을 수신할 때 가격 동력과 부피 확인이 여전히 필요합니다.

  4. 시스템적 위험에 대한 인식과 높은 시장 변동성 동안 맹목적인 거래를 피하십시오.

강화

이 전략은 몇 가지 측면에서 더 강화 될 수 있습니다.

  1. 이상적인 조합을 찾기 위해 백테스팅을 통해 RSI와 스토카스틱 매개 변수를 최적화합니다. 기계 학습 기술은 동적 매개 변수 최적화에도 적용 될 수 있습니다.

  2. 신호 확인을 위한 부피 지표들을 포함시키세요. 부피 스파이크 같은 것들이요.

  3. 트렌드를 따르는 오버레이를 추가하여 시장 소음과 윙사 (whipsaws) 를 피합니다. 트렌드가 상승할 때만 구매 신호를 고려하십시오.

  4. 기계 학습을 활용하여 보린저 밴드, 가격 패턴 등을 포함하는 더 정교한 신호 조합을 발견하여 일관성을 향상시킵니다.

  5. 심층 학습과 빅데이터 분석을 활용하여 보다 높은 샘플 효율을 가진 더 지능적인 다목적 거래 시스템을 개발합니다.

결론

요약하자면, RSI-스토카스틱 이중 전략은 앙상블 모델링을 통해 각각의 강점을 효과적으로 활용합니다. 독립적인 RSI와 비교했을 때 우수한 필터링 용량과 신호 정밀도를 제공합니다. 주의 사항에는 매개 변수 최적화 및 위험 통제가 포함됩니다. 방법론은 새로운 효과적인 거래 전략을 발견하기 위해 다른 지표를 결합하도록 확장 할 수 있습니다.


/*backtest
start: 2022-09-30 00:00:00
end: 2023-10-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
//Based on Divergences and Hidden Divergences
//Locates bottom market and reversals

strategy("Vix FIX / StochRSI Strategy", pyramiding=9, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=3, overlay=false)

///////////// Stochastic Slow
Stochlength = input(14, minval=1, title="lookback length of Stochastic")
StochOverBought = input(80, title="Stochastic overbought condition")
StochOverSold = input(20, title="Stochastic oversold condition")
smoothK = input(3, title="smoothing of Stochastic %K ")
smoothD = input(3, title="moving average of Stochastic %K")
k = sma(stoch(close, high, low, Stochlength), smoothK)
d = sma(k, smoothD)

 
///////////// RSI 
RSIlength = input( 14, minval=1 , title="lookback length of RSI")
RSIOverBought = input( 70  , title="RSI overbought condition")
RSIOverSold = input( 30  , title="RSI oversold condition")
RSIprice = close
vrsi = rsi(RSIprice, RSIlength)

///////////// Double strategy: RSI strategy + Stochastic strategy

pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")
lb = input(50  , title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
new = input(false, title="-------Text Plots Below Use Original Criteria-------" )
sbc = input(false, title="Show Text Plot if WVF WAS True and IS Now False")
sbcc = input(false, title="Show Text Plot if WVF IS True")
new2 = input(false, title="-------Text Plots Below Use FILTERED Criteria-------" )
sbcFilt = input(true, title="Show Text Plot For Filtered Entry")
sbcAggr = input(true, title="Show Text Plot For AGGRESSIVE Filtered Entry")
ltLB = input(40, minval=25, maxval=99, title="Long-Term Look Back Current Bar Has To Close Below This Value OR Medium Term--Default=40")
mtLB = input(14, minval=10, maxval=20, title="Medium-Term Look Back Current Bar Has To Close Below This Value OR Long Term--Default=14")
str = input(3, minval=1, maxval=9, title="Entry Price Action Strength--Close > X Bars Back---Default=3")
//Alerts Instructions and Options Below...Inputs Tab
new4 = input(false, title="-------------------------Turn On/Off ALERTS Below---------------------" )
new5 = input(false, title="----To Activate Alerts You HAVE To Check The Boxes Below For Any Alert Criteria You Want----")
sa1 = input(false, title="Show Alert WVF = True?")
sa2 = input(false, title="Show Alert WVF Was True Now False?")
sa3 = input(false, title="Show Alert WVF Filtered?")
sa4 = input(false, title="Show Alert WVF AGGRESSIVE Filter?")

//Williams Vix Fix Formula
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph

//Filtered Bar Criteria
upRange = low > low[1] and close > high[1]
upRange_Aggr = close > close[1] and close > open[1]
//Filtered Criteria
filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh))
filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and not (wvf < upperBand and wvf < rangeHigh)

//Alerts Criteria
alert1 = wvf >= upperBand or wvf >= rangeHigh ? 1 : 0
alert2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh) ? 1 : 0
alert3 = upRange and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered ? 1 : 0
alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr ? 1 : 0

//Coloring Criteria of Williams Vix Fix
col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray

isOverBought = (crossover(k,d) and k > StochOverBought) ? 1 : 0
isOverBoughtv2 = k > StochOverBought ? 1 : 0
filteredAlert = alert3 ? 1 : 0
aggressiveAlert = alert4 ? 1 : 0

plot(isOverBought, "Overbought / Crossover", style=line, color=red) 
plot(filteredAlert, "Filtered Alert", style=line, color=fuchsia) 
plot(aggressiveAlert, "Aggressive Alert", style=line, color=orange)

if (filteredAlert or aggressiveAlert)
    strategy.entry("Long", strategy.long)

if (isOverBought)
    strategy.close("Long")

    


더 많은