트렌드 추적을 위해 볼링거 밴드와 결합된 이중 RSI

저자:차오장, 날짜: 2023-09-19 22:10:02
태그:

전반적인 설명

이 전략은 과도한 구매 및 과도한 판매 조건을 식별하기 위해 이중 RSI 지표를 사용하여 거래 신호를 생성하기 위해 볼링거 밴드 브레이크오웃과 결합합니다. 트렌드를 따르는 전략 범주에 속합니다. 목표는 여러 지표를 결합하여 신호 신뢰성을 향상시키고 명백한 트렌드로부터 이익을 얻는 것입니다.

원칙 분석

이 전략은 단기 및 장기적 과소매/대수매 상태를 판단하기 위해 서로 다른 시간 프레임으로 두 개의 RSI를 사용합니다. 두 가지 RSI가 동시에 임계값에 도달 할 때만 거래 신호가 생성됩니다. 이것은 단일 RSI에서 잘못된 신호를 피합니다.

볼링거 밴드는 또한 가격 브레이크를 식별하는 데 사용됩니다. RSI 조건이 충족되고 가격이 브레이크 할 때만 볼링거 밴드 상부 / 하부 밴드는 거래 신호가 생성됩니다. 브레이크 확인은 트렌딩이 아닌 시장에서 신호를 피하는 데 도움이됩니다.

마지막으로, 빠른 및 느린 MAs는 트렌드 방향을 확인합니다. 브레이크 아웃이 RSI 신호 방향과 일치 할 때만 거래를 개시합니다.

이점 분석

여러 지표의 결합 사용은 잘못된 신호를 필터링하여 명백한 트렌드를 거래하는 데 도움이됩니다. 빠른 / 느린 MAs는 또한 트렌드를 따르는 것을 촉진합니다. 간단한 전략은 단기 트렌드에서 이익을 얻는 데 적합합니다.

위험 분석

주요 위험은 트렌드 반전을 신속히 식별하지 못하는 것입니다. 급격한 V 모양의 반전은 적절한 시간 정지 손실없이 상당한 손실로 이어질 수 있습니다. 매개 변수 조정 또한 성능에 영향을 줄 수 있습니다.

최적화 제안

  1. 손해를 막는 전략을 추가하여 반전 시 빠르게 빠져나갑니다.

  2. 부피와 같은 다른 필터를 포함해서 가짜 브레이크를 피합니다.

  3. 가장 좋은 조합을 찾기 위해 매개 변수를 최적화하세요.

  4. 시장 체제를 더 잘 식별하기 위해 기계 학습 모델을 추가합니다.

  5. 포지션 크기와 손실 통제를 포함한 리스크 관리 개선

결론

이 전략은 단기 트렌드에서 이익을 얻기 위해 이중 RSI와 볼링거 밴드를 결합합니다. 간단하고 직설적이지만 지연 된 반전 신호와 같은 한계가 있습니다. 스톱 로스, 신호 필터링, 매개 변수 최적화를 추가하면 안정성과 수익성을 더욱 향상시킬 수 있습니다.


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

//@version=2

strategy(title = "Madrugada strat copy", overlay = true, pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, currency = currency.USD)
 
// === GENERAL INPUTS ===
// RSI 1
RSIlength = input(10,title="RSI") 
RSIoverSold = input(65,title="OSold")
RSIoverBought = input(35,title="OBought")
price = close
vrsi = rsi(price, RSIlength)
// RSI 2
RSIlength2 = input(6,title="RSI2") 
RSIoverSold2 = input(65,title="OSold2")
RSIoverBought2 = input(35,title="OBought2")
price2 = close
vrsi2 = rsi(price2, RSIlength2)

//Bollinger Bands
source = close
Bollinger = input(20, minval=1), Desv = input(1.7, minval=0.001, maxval=50)
basis = sma(source, Bollinger)
dev = Desv * stdev(source, Bollinger)
upper = basis + dev
lower = basis - dev
plot(basis, color=red, title="BB ma")
p1 = plot(upper, color=blue, title="BBajo")
p2 = plot(lower, color=blue, title="BAlto")
fill(p1, p2)

//Media movil
short = input(3, minval=1, title="Media corta")
long = input(10, minval=1, title="Media larga")
src = close
plot(sma(src, short), color=#00FF00, transp=0, linewidth=1, title="Media rapida")
plot(sma(src, long), color=white, transp=0, linewidth=2, title="Media lenta")


// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => vrsi < 30 and  vrsi2 < 27 and cross(lower, price)
exitLong() => short < long
strategy.entry(id = "Long", long = true, when = enterLong()) // use function or simple condition to decide when to get in
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => vrsi > 70 and vrsi2 > 70 and cross(upper, price)
strategy.entry(id = "Short", long = false, when = enterShort())


// Definición señales de compra
buy_signals = vrsi < 30 and  vrsi2 < 27 and cross(lower, price)

// Definición señales de venta
sell_signals = vrsi > 70 and vrsi2 > 70 and cross(upper, price)

// Dibuja las señales de compra venta en franjas de color
b_color = (sell_signals) ? color(red,65) : (buy_signals) ? color(green,65) : na
bgcolor(b_color)

// Dibuja las señales de compra venta coloreando las velas
barcolor(buy_signals ? white : sell_signals ? white : na)

plot(vrsi, color=white, linewidth=1)
plot(vrsi, color=white, linewidth=2)

// Crea alarmas usables desde el desplegable para poder enviar mails a haas
alertcondition(buy_signals, title='Buy-Signal', message='compra')
alertcondition(sell_signals, title='Sell-Signal', message='vende')


더 많은