트리플 슈퍼트렌드와 볼린저 밴드를 결합한 다중 지표 트렌드 추종 전략

Boll ST ATR SMA BB MA
생성 날짜: 2024-12-20 14:28:58 마지막으로 수정됨: 2024-12-20 14:28:58
복사: 0 클릭수: 460
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

트리플 슈퍼트렌드와 볼린저 밴드를 결합한 다중 지표 트렌드 추종 전략

개요

이 전략은 부린밴드와 트리플 초상향 지표가 결합된 방법을 사용하여 거래한다. 부린밴드의 변동 영역 판단과 트리플 초상향의 트렌드 확인을 통해 안정적인 트렌드 추적 시스템을 형성한다. 부린밴드는 가격의 극단적 변동을 식별하는 데 사용되며, 트리플 초상향은 다른 파라미터 설정을 통해 트렌드 방향의 여러 가지 확인을 제공한다. 모든 신호가 일치할 때 거래하여 가짜 신호의 위험을 줄인다.

전략 원칙

전략의 핵심 논리는 다음과 같은 핵심 부분으로 구성됩니다.

  1. 20주기의 브린 대역을 사용하여, 표준 차이의 배수는 2.0이며, 가격 변동을 판단하기 위해 사용된다.
  2. 세 개의 초 트렌드 라인을 설정합니다. 주기는 각각 10입니다. 매개 변수는 각각 3.0, 4.0, 5.0입니다.
  3. 다중 입시 조건: 가격이 브린을 뚫고 궤도에 올랐으며 세 개의 초 트렌드 라인은 상승 추세를 나타냅니다.
  4. 공허 입시 조건: 가격이 부린 띠 아래로 떨어지고 세 개의 초 트렌드 라인이 모두 하향 추세를 나타냅니다.
  5. 임의의 초과 트렌드 라인이 방향을 변경할 때, 평준화는 현재 포지션을 유지합니다.
  6. 중간 가격 라인을 참조로 채우고, 시각적 효과를 강화

전략적 이점

  1. 다중 확인 메커니즘: 부린 밴드와 트리플 초상향의 조합을 통해 가짜 신호를 크게 감소시킵니다.
  2. 강력한 트렌드 추적 능력: 다양한 수준의 트렌드를 효과적으로 포착할 수 있는 초트렌드 지표의 점진적 파라미터 설정
  3. 리스크 관리가 완벽하다: 트렌드 전환의 징후가 있을 때 신속하게 청산하고, 통제된 회수
  4. 매개 변수 조정: 각 지표 매개 변수는 시장 특성에 따라 최적화 할 수 있습니다.
  5. 높은 수준의 자동화: 명확한 전략 논리, 체계적인 구현

전략적 위험

  1. 위축 시장 위험: 위축 시장에서 종종 가짜 브레이크 신호가 발생할 수 있습니다.
  2. 슬라이드 효과: 급격한 변동 기간 동안 큰 슬라이드 손실이 발생할 수 있습니다.
  3. 지연 위험: 복수의 인증 메커니즘으로 인해 입국이 늦어질 수 있습니다.
  4. 매개변수 민감도: 매개변수 조합이 다양하면 전략 성능에 큰 차이가 생길 수 있습니다.
  5. 시장 환경 의존성: 전략이 트렌드 시장에서 더 잘 작동합니다.

전략 최적화 방향

  1. 거래량 지표 도입: 거래량을 통해 가격 돌파의 유효성을 확인
  2. 최적화된 중지 메커니즘: 이동 중지 또는 ATR 기반의 동적 중단을 추가할 수 있습니다.
  3. 시간 필터링을 추가: 거래가 특정 시간 동안 금지되어 비효율적인 변동이 방지됩니다.
  4. 변동율 필터를 추가: 과도한 변동성이 있는 기간에 포지션을 조정하거나 거래를 중지
  5. 개발 매개 변수 적응 메커니즘: 시장 상태에 따라 동적으로 조정 매개 변수

요약하다

이것은 부린 띠와 트리플 초 트렌드를 결합한 트렌드 추적 전략으로, 다중 기술 지표의 확인을 통해 거래의 신뢰성을 향상시킵니다. 전략은 강력한 트렌드 캡처 능력과 위험 제어 능력을 가지고 있지만, 전략의 성능에 대한 시장 환경의 영향을 고려해야합니다. 지속적인 최적화 및 개선으로, 전략은 다양한 시장 조건에서 안정적인 성능을 유지할 수 있습니다.

전략 소스 코드
//@version=5
strategy("Demo GPT - Bollinger + Triple Supertrend Combo", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)

// -------------------------------
// User Input for Date Range
// -------------------------------
startDate = input(title="Start Date", defval=timestamp("2018-01-01 00:00:00"))
endDate   = input(title="End Date",   defval=timestamp("2069-12-31 23:59:59"))

// -------------------------------
// Bollinger Band Inputs
// -------------------------------
lengthBB = input.int(20, "Bollinger Length")
multBB   = input.float(2.0, "Bollinger Multiplier")

// -------------------------------
// Supertrend Inputs for 3 lines
// -------------------------------
// Line 1
atrPeriod1 = input.int(10, "ATR Length (Line 1)", minval = 1)
factor1    = input.float(3.0, "Factor (Line 1)", minval = 0.01, step = 0.01)

// Line 2
atrPeriod2 = input.int(10, "ATR Length (Line 2)", minval = 1)
factor2    = input.float(4.0, "Factor (Line 2)", minval = 0.01, step = 0.01)

// Line 3
atrPeriod3 = input.int(10, "ATR Length (Line 3)", minval = 1)
factor3    = input.float(5.0, "Factor (Line 3)", minval = 0.01, step = 0.01)

// -------------------------------
// Bollinger Band Calculation
// -------------------------------
basis = ta.sma(close, lengthBB)
dev   = multBB * ta.stdev(close, lengthBB)
upperBand = basis + dev
lowerBand = basis - dev

// Plot Bollinger Bands
plot(upperBand, "Upper BB", color=color.new(color.blue, 0))
plot(basis,     "Basis",    color=color.new(color.gray, 0))
plot(lowerBand, "Lower BB", color=color.new(color.blue, 0))

// -------------------------------
// Supertrend Calculation Line 1
// -------------------------------
[supertrendLine1, direction1] = ta.supertrend(factor1, atrPeriod1)
supertrendLine1 := barstate.isfirst ? na : supertrendLine1

upTrend1   = plot(direction1 < 0 ? supertrendLine1 : na, "Up Trend 1",   color = color.green, style = plot.style_linebr)
downTrend1 = plot(direction1 < 0 ? na : supertrendLine1, "Down Trend 1", color = color.red,   style = plot.style_linebr)

// -------------------------------
// Supertrend Calculation Line 2
// -------------------------------
[supertrendLine2, direction2] = ta.supertrend(factor2, atrPeriod2)
supertrendLine2 := barstate.isfirst ? na : supertrendLine2

upTrend2   = plot(direction2 < 0 ? supertrendLine2 : na, "Up Trend 2",   color = color.new(color.green, 0), style = plot.style_linebr)
downTrend2 = plot(direction2 < 0 ? na : supertrendLine2, "Down Trend 2", color = color.new(color.red, 0),   style = plot.style_linebr)

// -------------------------------
// Supertrend Calculation Line 3
// -------------------------------
[supertrendLine3, direction3] = ta.supertrend(factor3, atrPeriod3)
supertrendLine3 := barstate.isfirst ? na : supertrendLine3

upTrend3   = plot(direction3 < 0 ? supertrendLine3 : na, "Up Trend 3",   color = color.new(color.green, 0), style = plot.style_linebr)
downTrend3 = plot(direction3 < 0 ? na : supertrendLine3, "Down Trend 3", color = color.new(color.red, 0),   style = plot.style_linebr)

// -------------------------------
// Middle line for fill (used as a reference line)
// -------------------------------
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, "Body Middle", display = display.none)

// Fill areas for each supertrend line
fill(bodyMiddle, upTrend1,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend1, color.new(color.red,   90), fillgaps = false)

fill(bodyMiddle, upTrend2,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend2, color.new(color.red,   90), fillgaps = false)

fill(bodyMiddle, upTrend3,   color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend3, color.new(color.red,   90), fillgaps = false)

// Alerts for the first line only (as an example)
alertcondition(direction1[1] > direction1, title='Downtrend to Uptrend (Line 1)', message='Supertrend Line 1 switched from Downtrend to Uptrend')
alertcondition(direction1[1] < direction1, title='Uptrend to Downtrend (Line 1)', message='Supertrend Line 1 switched from Uptrend to Downtrend')
alertcondition(direction1[1] != direction1, title='Trend Change (Line 1)', message='Supertrend Line 1 switched trend')

// -------------------------------
// Strategy Logic
// -------------------------------
inDateRange = true

// Long Conditions
longEntryCondition = inDateRange and close > upperBand and direction1 < 0 and direction2 < 0 and direction3 < 0
longExitCondition = direction1 > 0 or direction2 > 0 or direction3 > 0

// Short Conditions
shortEntryCondition = inDateRange and close < lowerBand and direction1 > 0 and direction2 > 0 and direction3 > 0
shortExitCondition = direction1 < 0 or direction2 < 0 or direction3 < 0

// Execute Long Trades
if longEntryCondition and strategy.position_size <= 0
    strategy.entry("Long", strategy.long)

if strategy.position_size > 0 and longExitCondition
    strategy.close("Long")

// Execute Short Trades
if shortEntryCondition and strategy.position_size >= 0
    strategy.entry("Short", strategy.short)

if strategy.position_size < 0 and shortExitCondition
    strategy.close("Short")