모멘텀 브레이크아웃 트레이딩 전략


생성 날짜: 2023-12-19 15:46:38 마지막으로 수정됨: 2023-12-19 15:46:38
복사: 2 클릭수: 573
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

모멘텀 브레이크아웃 트레이딩 전략

개요

모멘텀 브레이크아웃 트레이딩 전략 (Momentum Breakout Trading Strategy) 은 트렌드 추적 전략으로, 가격의 중요한 지지부진을 탐지하여 거래 신호를 생성한다. 이 전략은 Donchian Channel 지표의 동력을 사용하여 중요한 지지부진을 결정하고, 이동 평균 지표와 결합하여 추가로 신호를 필터링하여 잘못된 거래를 방지한다.

전략 원칙

이 전략의 핵심 지표는 Donchian Channel이다. Donchian Channel은 최고 가격, 최저 가격, 중선 가격으로 구성된다. 채널 궤도 상단과 하단 라인은 각각 일정 주기 동안의 최고 가격과 최저 가격을 연결한다. 가격이 채널 궤도를 돌파할 때 구매 신호를 발생시키고, 가격이 채널 궤도를 넘어설 때 판매 신호를 발생시킨다. 이것은 시장 동력의 변화를 반영한다.

이동 평균은 가격 트렌드 방향을 판단하는 데 사용됩니다. 가격이 이동 평균 위에 있을 때만, 통로 상반도를 돌파하는 구매 신호가 채택됩니다. 이는 평형 영역을 구입하는 것을 피할 수 있습니다.

구체적으로, 이 전략의 상장 조건은: 가격이 Donchian Channel 상도를 뚫고, 그리고 폐쇄 가격은 이동 평균보다 높습니다. 출장 조건은: 가격이 Donchian Channel 하도를 넘어갑니다.

스톱패스는 Donchian Channel의 하락을 추적하는 방식이다. 이것은 스톱패스가 트렌드 진행에 따라 올라가는 것을 보장한다.

우위 분석

이 전략은 트렌드 방향과 강도를 판단하는 두 가지 지표를 결합하여 브레이크 신호를 효과적으로 식별하고 잘못된 거래를 피할 수 있습니다. 동시에, 중지 방법은 합리적입니다. 따라서 전략은 트렌드를 충분히 추적 할 수 있습니다.

특히, 이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. Donchian Channel 지표는 동적으로 중요한 지지 저항 지점을 결정하고, 트렌드의 중요한 전환점을 식별할 수 있다.

  2. 이동 평균 지표는 필터로 사용되며, 정렬 영역에 대한 구매를 방지하고, 무효 거래의 감소를 방지합니다.

  3. 스톱로스는 Donchian Channel의 하향 궤도를 추적하여 트렌드를 최대한 추적하여 수익을 창출합니다.

  4. 전략 매개 변수 설정은 합리적인 유연성으로, 다른 시장 환경에 맞게 조정 및 최적화를 할 수 있다.

위험 분석

이 전략의 주요 위험은 다음과 같습니다.

  1. 파격 실패의 위험. 가격 파격 통로가 궤도에 올랐을 때 빠르게 회수될 수 있으며, 효율적으로 매장할 수 없다.

  2. 트렌드 반전의 위험. 시장 상황이 스톱로스 포인트 이전에 반전되어 스톱로스 출전을 초래할 수 있다.

  3. 매개 변수 최적화 위험. 부적절한 매개 변수 설정은 거래 빈도 또는 신호 부족으로 이어질 수 있다.

이러한 위험에 대해, 이동 평균 주기 조정, 거래량 필터링을 증가시키는 등의 방법으로 최적화 할 수 있으며, 생성 된 신호가 더 신뢰할 수 있도록 보장 할 수 있습니다. 또한, 적절한 Loose 일부 Stop Loss 설정은 단기 조정의 위험에 대응해야합니다.

최적화 방향

이 전략은 다음의 몇 가지 측면에서 더 개선될 수 있습니다.

  1. 트랜스포메이션을 이용하여 신호를 필터링하여 강력한 돌파구를 확보하십시오.

  2. 이동 평균 주기 변수를 최적화하여 다양한 품종의 특성에 더 적합하게 만듭니다.

  3. 손해 제도를 조정하여, 손해 제격이 시장의 변동에 적응할 수 있도록 한다.

  4. 다시 출전하는 메커니즘을 추가하여 출전이 중단된 후 다시 트렌드 기회를 잡을 수 있습니다.

  5. 다종 재검토, 매개 변수의 건전성을 검사한다. 다양한 품종 특성에 따라 미세하게 조정한다.

요약하다

동적 돌파 거래 전략은 트렌드 방향과 강도를 판단하는 여러 지표를 통합하여 일반적인 트렌드 시스템의 맹목적인 포지션 문제를 해결한다. 이 전략의 매개 변수는 다양한 상황 환경과 거래 품종에 최적화된 조정할 수 있도록 유연하게 설정되어 있으며, 일반적이고 실전적인 돌파 시스템이다.

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

//@version=4

// Revision:        1
// Author:          @millerrh
// Strategy:  
//      Entry: Buy when Donchian Channel breaks out
//      Exit: Trail a stop with the lower Donchian Channel band
// Conditions/Variables:
//    1. Can add a filter to only take setups that are above a user-defined moving average (helps avoid trading counter trend) 
//    2. Manually configure which dates to back test
//    3. User-Configurable DC Channel length


// === CALL STRATEGY/STUDY, PROGRAMATICALLY ENTER STRATEGY PARAMETERS HERE SO YOU DON'T HAVE TO CHANGE THEM EVERY TIME YOU RUN A TEST ===
// (STRATEGY ONLY) - Comment out srategy() when in a study() 
strategy("Donchian Breakout", overlay=true, initial_capital=10000, currency='USD', 
   default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1)
// (STUDY ONLY) - Comment out study() when in a strategy() 
//study("Donchian Breakout", overlay=true)


// === BACKTEST RANGE ===
From_Year  = input(defval = 2019, title = "From Year")
From_Month = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
From_Day   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
To_Year    = input(defval = 9999, title = "To Year")
To_Month   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
To_Day     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
Start  = timestamp(From_Year, From_Month, From_Day, 00, 00)  // backtest start window
Finish = timestamp(To_Year, To_Month, To_Day, 23, 59)        // backtest finish window

// == INPUTS ==
trigInput = input(title = "Execute Trades On...", defval = "Wick", options=["Wick","Close"]) // Useful for comparing standing stop orders vs. waiting for candle closes prior to action
stopTrail = input(title = "Trail Stops On...", defval = "ATR", options = ["ATR","Bottom of DC Channel","Midline of DC Channel","Tightest of ATR/Bot DC Channel"])
dcPeriod = input(title="DC period", type=input.integer, defval=20)

// === PLOT THE DONCHIAN CHANNEL ===
// Logic
dcUpper = highest(high, dcPeriod)
dcLower = lowest(low, dcPeriod)
dcMid = avg(dcUpper, dcLower)

// Plotting
dcUplot = plot(dcUpper, color=color.blue, linewidth=1, title="Upper Channel Line")
dcLplot = plot(dcLower, color=color.blue, linewidth=1, title="Lower Channel Line")
dcMidPlot = plot(dcMid, color=color.gray, linewidth=1, title="Mid-Line Average")
fill(dcUplot, dcLplot, color=color.gray, transp=90)

// == FILTERING ==
// Inputs
useMaFilter = input(title = "Use MA for Filtering?", type = input.bool, defval = true)
maType = input(defval="SMA", options=["EMA", "SMA"], title = "MA Type For Filtering")
maLength   = input(defval = 100, title = "MA Period for Filtering", minval = 1)

// Declare function to be able to swap out EMA/SMA
ma(maType, src, length) =>
    maType == "EMA" ? ema(src, length) : sma(src, length) //Ternary Operator (if maType equals EMA, then do ema calc, else do sma calc)
maFilter = ma(maType, close, maLength)
plot(maFilter, title = "Trend Filter MA", color = color.green, linewidth = 3, style = plot.style_line, transp = 50)

// Check to see if the useMaFilter check box is checked, this then inputs this conditional "maFilterCheck" variable into the strategy entry 
maFilterCheck = if useMaFilter == true
    maFilter
else
    0

// == ENTRY AND EXIT CRITERIA ==
// Trigger stop based on candle close or High/Low (i.e. Wick) - If doing daily timeframe, can do candle close.  Intraday should use wick.
trigResistance = trigInput == "Close" ? close : trigInput == "Wick" ? high : na
trigSupport = trigInput == "Close" ? close : trigInput == "Wick" ? low : na
buySignal = trigResistance >= dcUpper[1] // The [1] looks at the previous bar's value as it didn't seem to be triggering correctly without it (likely) DC moves with each bar
sellSignal = trigSupport <= dcLower[1]

buy = buySignal and dcUpper[1] > maFilterCheck // All these conditions need to be met to buy


// (STRATEGY ONLY) Comment out for Study
// This string of code enters and exits at the close
if (trigInput == "Close")
    strategy.entry("Long", strategy.long, when = buy)
    strategy.close("Long", when = sellSignal)

// This string of code enters and exits at the wick (i.e. with pre-set stops)
if (trigInput == "Wick")
    strategy.entry("Long", strategy.long, stop = dcUpper[1], when = time > Start and time < Finish and dcUpper[1] > maFilterCheck)
    strategy.exit("Exit Long", from_entry = "Long", stop = dcLower[1])