볼린저 밴드 백분율 지표를 기반으로 한 디트렌딩 전략


생성 날짜: 2023-12-06 14:43:39 마지막으로 수정됨: 2023-12-06 14:43:39
복사: 0 클릭수: 651
avatar of ChaoZhang ChaoZhang
1
집중하다
1619
수행원

볼린저 밴드 백분율 지표를 기반으로 한 디트렌딩 전략

개요

이 전략은 RSI와 MFI 지표와 결합된 부린 대역 비율 지표를 기반으로, 금융 상품 가격이 부린 대역을 뚫고 하락하는 것을 탐지하고, RSI 과잉 오버 바이와 MFI 과잉 오버 바이 신호와 결합하여 더 많은 상장 결정을 내립니다. 전형적인 트렌드 거래 전략입니다.

전략 원칙

  1. 부린띠 비율을 계산하라 (BB%) ᄂ.BB%는 부린띠 중간 궤도에 대한 가격의 표준 차이를 나타내며, 부린띠 통로를 통해 시장 방향을 판단한다.
  2. RSI와 MFI 지표가 결합되어 과매매를 판단한다. RSI는 한 기간 동안의 평균 상승과 평균 하락을 비교하여 과매매를 판단한다. MFI는 거래량 상승과 거래량 하락을 비교하여 과매매를 판단한다.
  3. 가격이 아래에서 아래로 브린을 뚫고 내려가면 더 많이 하고; 가격이 위에서 아래로 브린을 뚫고 올라갈 때 더 많이 한다. RSI와 MFI 지표의 과매매 신호를 필터링하는 동시에.

전략적 이점

  1. 트렌드 트레이딩, 시장의 흐름을 피하고 수익의 변동성을 줄이는 것.
  2. 여러 지표의 필터링 신호를 결합하여 의사 결정의 정확성을 향상시킵니다.
  3. 매개 변수 설정은 유연하고, 전략 위험 수익 특성을 조정할 수 있다.
  4. 상품, 외환, 암호화폐 등과 같은 높은 변동성 지표에 적용됩니다.

위험과 해결

  1. 브린 벨트 돌파는 가짜 신호를 생성할 가능성이 높으며, 여러 지표 조합 필터링이 필요합니다.
  2. 은 신호 판단은 적절한 여유가 필요하며, 좋은 기회를 놓치지 않도록 한다.
  3. 매개 변수 설정을 조정하여 포지션 규모를 조정하고, 스톱 라인을 높이는 등 위험을 제어합니다.

최적화 방향

  1. ATR 지표와 같은 변동율 기반의 손해 방지 장치를 추가합니다.
  2. 기계학습 모형을 도입하여 브레이크 신호의 질을 판단할 수 있다.
  3. 참여 품종 선택 메커니즘을 최적화하고, 동적으로 참여 지표의 조정.
  4. 감정 지표, 뉴스 면 등과 같은 더 많은 요소와 결합하여 의사 결정 시스템을 개선하십시오.

요약하다

이 전략은 주로 높은 변동의 비 트렌드 품종에 적용되며, 브린 밴드 채널과 지표 조합을 판단하여 트렌드 해소를 실현한다. 파라미터를 조정하여 위험 수익 특성을 제어 할 수 있다. 후속으로 더 많은 보조 지표와 모델이 도입되어 의사 결정 품질을 최적화하여 더 나은 전략 성능을 얻을 수 있다.

전략 소스 코드
/*backtest
start: 2023-11-05 00:00:00
end: 2023-12-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "BB%/MFI/RSI", shorttitle = "BB%/MFI/RSI", default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 100)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(false, defval = false, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot, %")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From Day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To Day")

source = hlc3
length = input(14, minval=1), mult = input(2.0, minval=0.001, maxval=50), bblength = input(50, minval=1, title="BB Period")
DrawRSI_f=input(true, title="Draw RSI?", type=bool)
DrawMFI_f=input(false, title="Draw MFI?", type=bool)
HighlightBreaches=input(true, title="Highlight Oversold/Overbought?", type=bool)

DrawMFI = (not DrawMFI_f) and (not DrawRSI_f) ? true : DrawMFI_f
DrawRSI = (DrawMFI_f and DrawRSI_f) ? false : DrawRSI_f
// RSI
rsi_s = DrawRSI ? rsi(source, length) : na
plot(DrawRSI ? rsi_s : na, color=maroon, linewidth=2)

// MFI
upper_s = DrawMFI ? sum(volume * (change(source) <= 0 ? 0 : source), length) : na
lower_s = DrawMFI ? sum(volume * (change(source) >= 0 ? 0 : source), length) : na
mf = DrawMFI ? rsi(upper_s, lower_s) : na
plot(DrawMFI ? mf : na, color=green, linewidth=2)

// Draw BB on indices
bb_s = DrawRSI ? rsi_s : DrawMFI ? mf : na
basis = sma(bb_s, length)
dev = mult * stdev(bb_s, bblength)
upper = basis + dev
lower = basis - dev
plot(basis, color=red)
p1 = plot(upper, color=blue)
p2 = plot(lower, color=blue)
fill(p1,p2, blue)

b_color = (bb_s > upper) ? red : (bb_s < lower) ? lime : na
bgcolor(HighlightBreaches ? b_color : na, transp = 0)

//Signals
up = bb_s < lower and close < open
dn = bb_s > upper and close > open
size = strategy.position_size
lp = size > 0 and close > open
sp = size < 0 and close < open
exit = (up == false and dn == false) and (lp or sp)

//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 : lot[1]
if up
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if dn
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
    strategy.close_all()