高度な複数パターンブレイクアウト取引戦略

DOJI PIN BAR HAMMER BREAKOUT CANDLESTICK RSI
作成日: 2025-02-20 13:33:36 最終変更日: 2025-02-20 13:33:36
コピー: 0 クリック数: 349
2
フォロー
319
フォロワー

高度な複数パターンブレイクアウト取引戦略 高度な複数パターンブレイクアウト取引戦略

概要

この戦略は,多技術的な形状認識に基づいた高度な取引システムで,図形状分析と突破取引原理を統合している.この戦略は,十字星形 ((Doji),線形 ((Hammer) と針形P ((in Bar) を含む,多くのクラシックな図形状を認識し,取引することができる.同時に,双確認システムと組み合わせて,取引の信号の信頼性を高める.

戦略原則

戦略の核心的な論理は,以下の重要な要素に基づいています.

  1. 形状認識システム - 精密な数学的計算によって,三つの重要な図形状:十字星,線,針線の形状を識別する.各形状は,実体と影線の比率関係のような独自の識別基準を持っています.
  2. 突破確認メカニズム - 偽信号を減らすために,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")