모멘텀 브레이크업 거래 전략

저자:차오장, 날짜: 2023-12-19 15:46:38
태그:

img

전반적인 설명

모멘텀 브레이크아웃 트레이딩 전략 (Momentum Breakout Trading Strategy) 은 주요 지지/저항 수준을 초과한 가격 브레이크아웃을 탐지함으로써 트레이딩 신호를 생성하는 트렌드 추종 전략이다. 이 전략은 돈치안 채널 지표를 활용하여 주요 지지/저항 수준을 동적으로 식별하고 잘못된 거래를 피하기 위해 이동 평균으로 신호를 필터링한다.

전략 논리

이 전략의 핵심 지표는 돈치안 채널이다. 돈치안 채널은 정해진 기간 동안 가장 높은 가격, 가장 낮은 가격 및 중간 가격으로 구성되어 있다. 채널의 상부 및 하부 대역은 룩백 기간 동안 가장 높은 가격과 가장 낮은 가격을 각각 연결한다. 가격이 상부 대역 이상으로 넘어가면 긴 신호가 생성되며, 하부 대역 아래로 넘어가면 짧은 신호가 생성되며 시장 추진력의 변화를 반영한다.

이동 평균은 트렌드 방향을 측정하는 데 사용됩니다. 통합을 피하기 위해 이동 평균 이상의 가격으로 구매 신호만 취합니다.

구체적으로, 진입 조건은: 가격이 돈치안 채널 상단역을 넘어서고 이동 평균보다 닫는다. 출구 조건은: 가격이 돈치안 채널 하단역을 넘어서다.

스톱 손실은 돈치안 채널 하단 밴드를 따라가며, 트렌드와 함께 스톱 손실이 더 높게 조정되도록 합니다.

이점 분석

이 전략은 트렌드 방향과 동력을 판단하기 위해 두 가지 지표를 효과적으로 결합하여 잘못된 브레이크아웃 신호로 인한 잘못된 거래를 피합니다. 한편, 트레일링 스톱은 트렌드를 따라 수익을 극대화 할 수 있습니다.

특히 이점은 다음과 같습니다.

  1. 돈치안 채널은 트렌드 전환점을 식별하여 주요 지지/저항 수준을 동적으로 결정합니다.

  2. 이동평균은 통폐합을 필터링하고 불필요한 윙사 (whispsaws) 를 피합니다.

  3. 돈치안 채널 하단역을 따라가면 이윤을 극대화할 수 있습니다.

  4. 합리적인 매개 변수는 다양한 시장 환경에서 유연성을 제공합니다.

위험 분석

주요 위험은 다음과 같습니다.

  1. 실패한 파업 위험 - 가격이 상단 범위를 초과한 파업 이후의 추진력을 유지할 수 없습니다.

  2. 트렌드 역전 위험 - 트레일링 스톱 로스를 달성하기 전에 가격이 역전됩니다.

  3. 매개 변수 최적화 위험 - 비효율적인 매개 변수는 과도한 거래 또는 불충분한 신호로 이어집니다.

완화하기 위해, 부피 확인, 이동 평균 조정, 합리적인 정지 거리 같은 요소가 포함되어야 합니다.

더 나은 기회

추가 최적화:

  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])





더 많은