고급 다중 패턴 브레이크아웃 트레이딩 전략

DOJI PIN BAR HAMMER BREAKOUT CANDLESTICK RSI
생성 날짜: 2025-02-20 13:33:36 마지막으로 수정됨: 2025-02-20 13:33:36
복사: 0 클릭수: 349
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

고급 다중 패턴 브레이크아웃 트레이딩 전략 고급 다중 패턴 브레이크아웃 트레이딩 전략

개요

이 전략은 다중 기술 형태 인식에 기반한 고급 거래 시스템으로, 그래프 형태 분석과 돌파구 거래 원리를 통합한다. 전략은 십자가 별 모양 ((Doji), 바늘 줄 모양 ((Hammer) 및 바늘 모양 P ((in Bar) 을 포함한 여러 가지 클래식 그래프 형태를 식별하고 거래할 수 있으며, 쌍둥이 확인 시스템을 결합하여 거래 신호의 신뢰성을 강화한다.

전략 원칙

이 전략의 핵심 논리는 다음과 같은 몇 가지 핵심 요소에 기반합니다.

  1. 형태 인식 시스템 - 세 가지 중요한 도형 형태를 정확하게 수학적으로 식별합니다. 십자성, 오리선, 바늘 모양. 각 형태는 개체와 그림자 선의 비율 관계와 같은 고유한 식별 기준을 가지고 있습니다.
  2. 돌파 확인 메커니즘 - 쌍방향 확인 시스템을 적용하여, 두 번째 선이 이전 선의 고점 ((多做) 또는 저점 ((空做) 을 돌파하도록 요구하여, 가짜 신호를 줄이기 위해.
  3. 목표 가격 지표 - 조정 가능한 회귀 기간을 사용하여 (설정 20주기) 가장 최근의 최고점 또는 최저점을 목표 가격 지표로 설정하여 전략을 동적으로 적응시킬 수 있습니다.

전략적 이점

  1. 다중 형태 인식 - 동시에 여러 가지 기술 형태를 모니터링하여 잠재적인 거래 기회를 크게 증가시킵니다.
  2. 신호 확인 메커니즘 - 쌍방향 확인 시스템은 가짜 신호의 위험을 효과적으로 낮춘다.
  3. 거래 구역을 시각화 - 거래 구역을 표시하기 위해 색상 상자를 사용하여 거래 목표를 더 직관적으로 표시하십시오.
  4. 유연한 변수 조정 - 상이한 시장 조건에 따라 회수 기간과 같은 변수를 조정할 수 있다.

전략적 위험

  1. 시장의 변동 위험 - 높은 변동 동안 가짜 브레이크 신호가 발생할 수 있습니다.
  2. 슬라이드 리스크 - 유동성이 낮은 시장에서 실제 거래 가격은 신호 가격과 큰 편차가 있을 수 있다.
  3. 트렌드 반전 위험 - 강한 트렌드 시장에서 반전 신호는 큰 손실을 초래할 수 있다.

최적화 방향

  1. 교류량 확인 도입 - 신호의 신뢰성을 높이기 위해 형태 인식 시스템에 교류량 분석을 추가하는 것이 좋습니다.
  2. 다이내믹 스톱로스 메커니즘 - ATR 또는 변동률에 따라 다이내믹 스톱로스를 설정할 수 있다.
  3. 시장 환경 필터 - 트렌드 강도 지표를 추가하여 강력한 트렌드 동안 역전 신호를 필터링합니다.
  4. 시간 프레임 최적화 - 여러 시간 프레임에서 신호 확인을 고려하십시오.

요약하다

이 전략은 다중 기술 형태 분석과 돌파구 거래 원칙을 결합하여 완전한 거래 시스템을 구축한다. 이 전략의 장점은 신호의 다차원 확인과 유연한 파라미터 조정이지만, 시장의 변동과 유동성 위험에 주의를 기울여야 한다. 제안된 최적화 방향을 통해 전략의 안정성과 신뢰성을 더욱 향상시킬 수 있다.

전략 소스 코드
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/

//@version=5
strategy("Target(Made by Karan)", overlay=true)

// Input for lookback period
lookbackPeriod = input.int(20, title="Lookback Period for Recent High/Low", minval=1)

// --- Pattern Identification Functions ---

// Identify Doji pattern
isDoji(open, high, low, close) =>
    bodySize = math.abs(close - open)
    rangeSize = high - low
    bodySize <= rangeSize * 0.1  // Small body compared to total range

// Identify Hammer pattern
isHammer(open, high, low, close) =>
    bodySize = math.abs(close - open)
    lowerShadow = open - low
    upperShadow = high - close
    bodySize <= (high - low) * 0.3 and lowerShadow > 2 * bodySize and upperShadow <= bodySize * 0.3  // Long lower shadow, small upper shadow

// Identify Pin Bar pattern
isPinBar(open, high, low, close) =>
    bodySize = math.abs(close - open)
    rangeSize = high - low
    upperShadow = high - math.max(open, close)
    lowerShadow = math.min(open, close) - low
    (upperShadow > bodySize * 2 and lowerShadow < bodySize) or (lowerShadow > bodySize * 2 and upperShadow < bodySize)  // Long shadow on one side

// --- Candle Breakout Logic ---

// Identify the first green candle (Bullish)
is_first_green_candle = close > open

// Identify the breakout above the high of the first green candle
breakout_green_candle = ta.crossover(close, high[1]) and is_first_green_candle[1]

// Identify the second green candle confirming the breakout
second_green_candle = close > open and breakout_green_candle[1]

// Find the recent high (for the target)
recent_high = ta.highest(high, lookbackPeriod)  // Use adjustable lookback period

// Plot the green rectangle box if the conditions are met and generate buy signal
var float start_price_green = na
var float end_price_green = na

if second_green_candle
    start_price_green := low[1]  // Low of the breakout green candle
    end_price_green := recent_high  // The most recent high in the lookback period
    strategy.entry("Buy", strategy.long)  // Buy signal

// --- Red Candle Logic ---

// Identify the first red candle (Bearish)
is_first_red_candle = close < open

// Identify the breakdown below the low of the first red candle
breakdown_red_candle = ta.crossunder(close, low[1]) and is_first_red_candle[1]

// Identify the second red candle confirming the breakdown
second_red_candle = close < open and breakdown_red_candle[1]

// Find the recent low (for the target)
recent_low = ta.lowest(low, lookbackPeriod)  // Use adjustable lookback period

// Plot the red rectangle box if the conditions are met and generate sell signal
var float start_price_red = na
var float end_price_red = na

if second_red_candle
    start_price_red := high[1]  // High of the breakout red candle
    end_price_red := recent_low  // The most recent low in the lookback period
    strategy.entry("Sell", strategy.short)  // Sell signal

// --- Pattern Breakout Logic for Doji, Hammer, Pin Bar ---

// Detect breakout of Doji, Hammer, or Pin Bar patterns
var float start_price_pattern = na
var float end_price_pattern = na

// Check for Doji breakout
if isDoji(open, high, low, close) and ta.crossover(close, high[1])
    start_price_pattern := low[1]  // Low of the breakout Doji
    end_price_pattern := recent_high  // The most recent high in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = end_price_pattern, bottom = start_price_pattern, border_color = color.new(color.blue, 0), bgcolor = color.new(color.blue, 80))
    strategy.entry("Buy Doji", strategy.long)  // Buy signal for Doji breakout

// Check for Hammer breakout
if isHammer(open, high, low, close) and ta.crossover(close, high[1])
    start_price_pattern := low[1]  // Low of the breakout Hammer
    end_price_pattern := recent_high  // The most recent high in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = end_price_pattern, bottom = start_price_pattern, border_color = color.new(color.blue, 0), bgcolor = color.new(color.blue, 80))
    strategy.entry("Buy Hammer", strategy.long)  // Buy signal for Hammer breakout

// Check for Pin Bar breakout
if isPinBar(open, high, low, close) and ta.crossover(close, high[1])
    start_price_pattern := low[1]  // Low of the breakout Pin Bar
    end_price_pattern := recent_high  // The most recent high in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = end_price_pattern, bottom = start_price_pattern, border_color = color.new(color.blue, 0), bgcolor = color.new(color.blue, 80))
    strategy.entry("Buy Pin Bar", strategy.long)  // Buy signal for Pin Bar breakout

// Check for bearish Doji breakout
if isDoji(open, high, low, close) and ta.crossunder(close, low[1])
    start_price_pattern := high[1]  // High of the breakdown Doji
    end_price_pattern := recent_low  // The most recent low in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = start_price_pattern, bottom = end_price_pattern, border_color = color.new(color.orange, 0), bgcolor = color.new(color.orange, 80))
    strategy.entry("Sell Doji", strategy.short)  // Sell signal for Doji breakdown

// Check for bearish Hammer breakout
if isHammer(open, high, low, close) and ta.crossunder(close, low[1])
    start_price_pattern := high[1]  // High of the breakdown Hammer
    end_price_pattern := recent_low  // The most recent low in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = start_price_pattern, bottom = end_price_pattern, border_color = color.new(color.orange, 0), bgcolor = color.new(color.orange, 80))
    strategy.entry("Sell Hammer", strategy.short)  // Sell signal for Hammer breakdown

// Check for bearish Pin Bar breakout
if isPinBar(open, high, low, close) and ta.crossunder(close, low[1])
    start_price_pattern := high[1]  // High of the breakdown Pin Bar
    end_price_pattern := recent_low  // The most recent low in the lookback period
    box.new(left = bar_index[1], right = bar_index, top = start_price_pattern, bottom = end_price_pattern, border_color = color.new(color.orange, 0), bgcolor = color.new(color.orange, 80))
    strategy.entry("Sell Pin Bar", strategy.short)  // Sell signal for Pin Bar breakdown

// Optional: Plot shapes for the green sequence of candles
plotshape(series=is_first_green_candle, location=location.belowbar, color=color.green, style=shape.labelup, text="1st Green")
plotshape(series=breakout_green_candle, location=location.belowbar, color=color.blue, style=shape.labelup, text="Breakout")
plotshape(series=second_green_candle, location=location.belowbar, color=color.orange, style=shape.labelup, text="2nd Green")

// Optional: Plot shapes for the red sequence of candles
plotshape(series=is_first_red_candle, location=location.abovebar, color=color.red, style=shape.labeldown, text="1st Red")
plotshape(series=breakdown_red_candle, location=location.abovebar, color=color.blue, style=shape.labeldown, text="Breakdown")
plotshape(series=second_red_candle, location=location.abovebar, color=color.orange, style=shape.labeldown, text="2nd Red")