볼링거 밴드 RSI 듀얼라인 전략

저자:차오장, 날짜: 2023-12-26 15:30:26
태그:

img

전반적인 설명

이 전략은 볼링거 밴드와 상대적 강도 지표 (RSI) 를 결합합니다. 이 전략은 거래 신호를 발급하기 전에 두 지표 - RSI 과잉 구매 / 과잉 판매와 볼링거 밴드 상위 / 하위 라인의 브레이크오웃 - 의 신호를 필요로합니다. 이것은 전략의 신호를 더 엄격하고 신뢰할 수 있습니다.

전략 논리

  1. 중선, 상선 및 하선으로 구성된 볼린거 대역을 계산합니다.
  2. RSI 지표를 계산해서 시장이 너무 상승하거나 하락하는지를 판단합니다.
  3. RSI가 오버구입 (rsi_overbought 매개 변수보다 높다) 를 표시하고 가격이 볼링거 상위 라인 이상으로 떨어지면 마감 거래를 시작하십시오.
  4. RSI가 oversold (rsi_oversold 매개 변수보다 낮다) 를 표시하고 가격이 Bollinger 하위 라인 아래로 떨어지면만 긴 거래를 시작하십시오.

볼링거 밴드와 RSI의 동의를 요구함으로써 이 전략은 단일 지표에서 나오는 오해의 소지가 있는 신호에 따라 행동하는 것을 피하고, 따라서 더 신뢰할 수 있습니다.

장점

  1. 볼링거 밴드와 RSI의 강점을 활용하여 신호를 더 엄격하게 만들고 실수를 피합니다.
  2. 볼링거 밴드는 시장 변동성을 파악하기 위해 동적인 채널을 설정합니다.
  3. RSI는 과잉 매수/ 과잉 판매 시나리오를 측정하여, 최고치를 추격하거나 하락을 방지합니다.

위험성

  1. 부적절한 볼링거 매개 변수는 가격을 효과적으로 포괄하지 못할 수 있습니다.
  2. 부적절한 RSI 매개 변수들은 실제 과잉 구매/ 과잉 판매 상황을 정확하게 판단하지 못할 수 있습니다.
  3. 전략 자체는 트렌드 방향을 결정할 수 없으며 다른 지표가 필요합니다.

위의 위험을 해결하기 위해 매개 변수를 최적화하고 모델을 엄격하게 테스트하고 추가 지표로 주요 추세를 결정해야합니다.

최적화 방향

  1. 최적의 매개 변수를 찾기 위해 다른 룩백 기간으로 볼링거 밴드를 테스트하십시오.
  2. 비교적 더 나은 설정을 결정하기 위해 다른 RSI 매개 변수를 테스트합니다.
  3. 전체 트렌드를 결정하기 위해 이동 평균과 같은 다른 지표를 추가하십시오.

결론

이 전략은 볼링거 밴드와 RSI의 강점을 성공적으로 결합하여 두 지표가 동의 할 때만 거래 신호를 발산합니다. 이것은 단일 지표의 오해의 소지가있는 신호에 작용하는 것을 피하여 거래를 더 신뢰할 수 있습니다. 그럼에도 불구하고 매개 변수를 최적화하고 모델을 엄격하게 테스트하고 다른 지표와 주요 추세를 결정하여 전략의 안정성과 수익성을 더욱 향상시켜야합니다.


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

//@version=2
strategy("Bollinger + RSI, Double Strategy (by ChartArt) v1.1", shorttitle="CA_-_RSI_Bol_Strat_1.1", overlay=true)

// ChartArt's RSI + Bollinger Bands, Double Strategy - Update
//
// Version 1.1
// Idea by ChartArt on January 18, 2015.
//
// This strategy uses the RSI indicator 
// together with the Bollinger Bands 
// to sell when the price is above the
// upper Bollinger Band (and to buy when
// this value is below the lower band).
//
// This simple strategy only triggers when
// both the RSI and the Bollinger Bands
// indicators are at the same time in
// a overbought or oversold condition.
//
// In this version 1.1 the strategy was
// both simplified for the user and
// made more successful in backtesting. 
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/
// 
//  __             __  ___       __  ___ 
// /  ` |__|  /\  |__)  |   /\  |__)  |  
// \__, |  | /~~\ |  \  |  /~~\ |  \  |  
// 
// 


///////////// RSI
RSIlength = input(6,title="RSI Period Length") 
RSIoverSold = 50
RSIoverBought = 50
price = close
vrsi = rsi(price, RSIlength)


///////////// Bollinger Bands
BBlength = input(200, minval=1,title="Bollinger Period Length")
BBmult = 2 // input(2.0, minval=0.001, maxval=50,title="Bollinger Bands Standard Deviation")
BBbasis = sma(price, BBlength)
BBdev = BBmult * stdev(price, BBlength)
BBupper = BBbasis + BBdev
BBlower = BBbasis - BBdev
source = close
buyEntry = crossover(source, BBlower)
sellEntry = crossunder(source, BBupper)
plot(BBbasis, color=aqua,title="Bollinger Bands SMA Basis Line")
p1 = plot(BBupper, color=silver,title="Bollinger Bands Upper Line")
p2 = plot(BBlower, color=silver,title="Bollinger Bands Lower Line")
fill(p1, p2)


///////////// Colors
switch1=input(true, title="Enable Bar Color?")
switch2=input(true, title="Enable Background Color?")
TrendColor = RSIoverBought and (price[1] > BBupper and price < BBupper) and BBbasis < BBbasis[1] ? red : RSIoverSold and (price[1] < BBlower and price > BBlower) and BBbasis > BBbasis[1] ? green : na
barcolor(switch1?TrendColor:na)
bgcolor(switch2?TrendColor:na,transp=50)


///////////// RSI + Bollinger Bands Strategy
if (not na(vrsi))

    if (crossover(vrsi, RSIoverSold) and crossover(source, BBlower))
        strategy.entry("RSI_BB_L", strategy.long, stop=BBlower,  comment="RSI_BB_L")
    else
        strategy.cancel(id="RSI_BB_L")
        
    if (crossunder(vrsi, RSIoverBought) and crossunder(source, BBupper))
        strategy.entry("RSI_BB_S", strategy.short, stop=BBupper,  comment="RSI_BB_S")
    else
        strategy.cancel(id="RSI_BB_S")

//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

더 많은