볼링거 밴드 RSI 스윙 거래 전략

저자:차오장, 날짜: 2023-09-16 18:48:44
태그:

전반적인 설명

볼링거 밴드 RSI 스윙 트레이딩 전략은 볼링거 밴드 및 상대 강도 지수 (RSI) 지표를 결합하여 단기 범위 오스실레이션 거래를 수행합니다. 볼링거 밴드 상부 및 하부 간 가격 변동에서 이익을 얻습니다.

원칙

첫째, 볼링거 밴드 인디케이터는 가격 변동 범위를 분석합니다. 상위 범위에 가까운 가격은 과잉 구매되고, 하위 범위에 가까운 가격은 과잉 판매됩니다.

둘째, RSI 지표는 과잉 구매/ 과잉 판매 강도를 결정합니다. RSI 70 이상은 과잉 구매이며, 30 이하는 과잉 판매입니다.

가격이 하위 범위에 도달하고 RSI가 과잉 판매를 나타낼 때, 길게 가십시오. 가격이 상위 범위에 도달하고 RSI가 과잉 구매를 나타낼 때, 짧게 가십시오.

장점

  • 볼링거 밴드는 가격 변동 수준을 정확하게 파악합니다.

  • RSI는 맹목적으로 긴/단기 엔트리를 피합니다.

  • 높은 승률은 평균 회귀를 활용합니다.

  • 빈번한 거래는 지속적인 수익성을 제공합니다.

  • 다른 제품과 시간 프레임에 적용됩니다.

위험성

  • 부적절한 BB 매개 변수는 핵심 수준을 식별하지 못합니다.

  • 나쁜 RSI 매개 변수는 잘못된 신호를 생성합니다.

  • 불충분한 리트레이싱은 손실을 멈추게 합니다.

  • 높은 거래 빈도는 더 큰 미끄러짐 비용을 초래합니다.

  • 변동적인 시장에서 트렌드를 타는 것은 어렵습니다.

위험 관리

  • BB가 실제 변동성과 일치하도록 매개 변수를 최적화하세요.

  • 소음을 필터링하기 위해 RSI 기간을 조정합니다.

  • 수익을 줄이기 위해 트레일링 스톱을 사용하세요.

  • 유체 제품을 선택하여 미끄러지는 영향을 최소화하십시오.

  • 추세 방향을 결정하기 위해 다른 지표를 추가하십시오.

요약

BB RSI 스윙 트레이딩 전략은 범위 내에서 양방향 가격 변동을 효과적으로 잡습니다. 적절한 매개 변수 조정 및 리스크 관리로 안정적인 수익을 제공합니다. 이것은 권장되는 단기 양 거래 전략입니다.


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

//@version=4
strategy("Swing trading strategy FOREX ", shorttitle="BB+RSI", overlay=true)

////////////////////////////////////////////////////////////////////////////////
// BACKTESTING RANGE
 
// From Date Inputs
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
 
// To Date Inputs
toDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2022, title = "To Year", minval = 1970)
 
// Calculate start/end date and time condition
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
// 
// 


///////////// RSI
RSIlength = input(6,title="RSI Period Length") 
RSIoverSold = input(defval = 65, title = "RSIoverSold", minval = 1, maxval = 100)
RSIoverBought = input(defval = 35, title = "RSIoverBought", minval = 1, maxval = 100)
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=color.aqua,title="Bollinger Bands SMA Basis Line")
p1 = plot(BBupper, color=color.silver,title="Bollinger Bands Upper Line")
p2 = plot(BBlower, color=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] ? color.red : RSIoverSold and (price[1] < BBlower and price > BBlower) and BBbasis > BBbasis[1] ? color.green : na
barcolor(switch1?TrendColor:na)
bgcolor(switch2?TrendColor:na,transp=50)


///////////// RSI + Bollinger Bands Strategy
//for buy
cond1=crossover(vrsi, RSIoverSold)
cond2=crossover(source, BBlower) 
//for sell
cond3=crossunder(vrsi, RSIoverBought)
cond4=crossunder(source, BBupper)
if (not na(vrsi))

    if (cond1 and cond2 and time_cond)
        strategy.entry("RSI_BB_LONG", strategy.long, stop=BBlower, comment="LONG",alert_message = "long")
    else
        strategy.cancel(id="RSI_BB_LONG")
        
    if (cond3 and cond4 and time_cond)
        strategy.entry("RSI_BB_SHORT", strategy.short, stop=BBupper,  comment="SHORT",alert_message = "short")
        //strategy.close("RSI_BB_LONG")

    else
        strategy.cancel(id="RSI_BB_SHORT")
        
//strategy.exit("closelong", "RSI_BB_LONG" , profit = close * 0.01 / syminfo.mintick, loss = close * 0.01 / syminfo.mintick, alert_message = "closelong")
//strategy.exit("closeshort", "RSI_BB_SHORT" , profit = close * 0.01 / syminfo.mintick, loss = close * 0.01 / syminfo.mintick, alert_message = "closeshort")


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

더 많은