E9 シャーク 32 パターン定量価格ブレイクスルー戦略


作成日: 2024-11-12 14:51:17 最終変更日: 2024-11-12 14:51:17
コピー: 1 クリック数: 422
1
フォロー
1617
フォロワー

E9 シャーク 32 パターン定量価格ブレイクスルー戦略

概要

この戦略は,価格形態認識に基づく量的な取引システムであり,その核心は,32のような特殊なK線形状を認識し,それを利用して取引することである.この戦略は,高点と低点の連続的な変化を分析し,形状の確認後に重要な価格レベルを設定し,これらのレベルを突破すると取引する.この戦略は,形状認識,トレンド追跡,価格突破などの複数の技術分析要素を組み合わせて,完全な取引システムを構築する.

戦略原則

戦略の核心は,次の条件を満たす”32”の形状を識別することにある.前2つのK線の低点は連続的に下がり,高点は連続的に上がる.形状が確認された後,戦略は,形状の起点K線の高点と低点を重要な価格レベルとしてロックする.システムは,価格がこれらの重要なレベルを突破したときにポジションを開く.

戦略的優位性

  1. 形状認識の正確性:形状を厳格な数学的な定義によって認識し,主観的な判断を避けること
  2. リスク管理の完善:明確な止損と利益の目標設定を含む
  3. 視覚的フィードバックの明晰さ:形状と取引信号を表示するために,異なる色の線と背景を使用する
  4. 重複信号をフィルターする: 超取引を避けるために,各形態は1回の取引のみを許可する
  5. 合理的な目標設定:形状の変動幅に基づいて収益目標を設定し,リスクと利益の良好な比率を持つ

戦略リスク

  1. 横盤の振動で頻繁に偽のブレイクシグナルが生じる可能性
  2. スリップポイントリスク:高速で大きなスリップポイントが発生する可能性がある
  3. 単形式依存:単形式への過度な依存は,他の取引機会を逃す可能性があります.
  4. パラメータの感受性: ストップ・ロストとリターン・トーゲルのパラメータ設定は,戦略のパフォーマンスに大きな影響を与える

戦略最適化の方向性

  1. 取引量確認を追加: 取引量の変化を組み合わせて,突破の有効性を確認できます.
  2. 市場環境のフィルタリングを導入する:不利な市場環境をフィルタリングするためにトレンド強度指標を追加する
  3. 戦略の適応性を高めるために,動的ストップを使用することを検討する.
  4. タイムフィルターを追加:特定の時間の波動を避けるために取引時間フィルターを追加する
  5. 資金管理の改善:資金利用の効率を最適化するためにポジション管理モジュールを追加

要約する

E932形質量化価格突破戦略は,構造が整った,論理が明確な取引システムである.それは,厳格な形質の定義と明確な取引ルールを介して,量化可能な実行の取引戦略を構築している.戦略のリスク管理システムは完善し,視覚的フィードバックは明確で,トレーダーが容易に理解し,実行している.提案された最適化方向によって,戦略はさらに向上する余地がある.この戦略は,体系的な取引を追求する投資家に適しています.しかし,使用する際は,市場環境の適応性とパラメータの最適化に注意する必要があります.

ストラテジーソースコード
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//╔═════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
//║                                                                                                             ║
//║ ░▒▓████████▓▒░▒▓███████▓▒░ ░▒▓██████▓▒░░▒▓███████▓▒░░▒▓████████▓▒░▒▓███████▓▒░   ░▒▓████████▓▒░▒▓██████▓▒░  ║
//║    ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒   ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ ║
//║    ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒.  ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ ║
//║    ░▒▓█▓▒░   ░▒▓███████▓▒░░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓██████▓▒░ ░▒▓███████▓▒░.  ░▒▓██████▓▒░ ░▒▓███████▓▒░ ║
//║    ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒.  ░▒▓█▓▒░            ░▒▓█▓▒░ ║
//║    ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒.  ░▒▓█▓▒░            ░▒▓█▓▒░ ║
//║    ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒.  ░▒▓████████▓▒░▒▓██████▓▒░  ║
//║                                                                                                             ║
//╚═════════════════════════════════════════════════════════════════════════════════════════════════════════════╝

//@version=5
strategy("E9 Shark-32 Pattern Strategy with Target Lines", shorttitle="E9 Shark-32 Strategy", overlay=true)

// Inputs for background color settings
bgcolorEnabled = input(true, title="Enable Background Color")
bgcolorColor = input.color(color.new(color.blue, 90), title="Background Color")

// Inputs for bar color settings
barcolorEnabled = input(true, title="Enable Bar Color")
barcolorColor = input.color(color.rgb(240, 241, 154), title="Bar Color")

// Inputs for target lines settings
targetLinesEnabled = input(true, title="Enable Target Lines")
targetLineColor = input.color(color.white, title="Target Line Color")
targetLineThickness = input.int(1, title="Target Line Thickness", minval=1, maxval=5)

// Define Shark-32 Pattern
shark32 = low[2] < low[1] and low[1] < low and high[2] > high[1] and high[1] > high

// Initialize color variables for bars
var color barColorCurrent = na
var color barColor1 = na
var color barColor2 = na

// Update color variables based on Shark-32 pattern
barColorCurrent := barcolorEnabled and (shark32 or shark32[1] or shark32[2]) ? barcolorColor : na
barColor1 := barcolorEnabled and (shark32[1] or shark32[2]) ? barcolorColor : na
barColor2 := barcolorEnabled and shark32[2] ? barcolorColor : na

// Apply the bar colors to the chart
barcolor(barColorCurrent, offset=-2, title="Shark-32 Confirmed Current")
barcolor(barColor1, offset=-3, title="Shark-32 Confirmed Previous Bar 1")
barcolor(barColor2, offset=-4, title="Shark-32 Confirmed Previous Bar 2")

// Variables for locking the high and low of confirmed Shark-32
var float patternHigh = na
var float patternLow = na
var float upperTarget = na
var float lowerTarget = na

// Once Shark-32 pattern is confirmed, lock the patternHigh, patternLow, and target lines
if shark32
    patternHigh := high[2]  // The high of the first bar in Shark-32 pattern
    patternLow := low[2]    // The low of the first bar in Shark-32 pattern

    // Calculate the upper and lower white target lines
    upperTarget := patternHigh + (patternHigh - patternLow)  // Dotted white line above
    lowerTarget := patternLow - (patternHigh - patternLow)   // Dotted white line below

// Initialize variables for the lines
var line greenLine = na
var line redLine = na
var line upperTargetLine = na
var line lowerTargetLine = na

// Draw the lines based on the locked patternHigh, patternLow, and target lines
// if shark32
//     future_bar_index_lines = bar_index + 10

//     // Draw lines based on locked patternHigh and patternLow
//     greenLine := line.new(x1=bar_index[2], y1=patternHigh, x2=future_bar_index_lines, y2=patternHigh, color=color.green, width=2, extend=extend.none)
//     redLine := line.new(x1=bar_index[2], y1=patternLow, x2=future_bar_index_lines, y2=patternLow, color=color.red, width=2, extend=extend.none)

//     // Draw dotted white lines if targetLinesEnabled is true
//     if targetLinesEnabled
//         upperTargetLine := line.new(x1=bar_index[2], y1=upperTarget, x2=future_bar_index_lines, y2=upperTarget, color=targetLineColor, width=targetLineThickness, style=line.style_dotted, extend=extend.none)
//         lowerTargetLine := line.new(x1=bar_index[2], y1=lowerTarget, x2=future_bar_index_lines, y2=lowerTarget, color=targetLineColor, width=targetLineThickness, style=line.style_dotted, extend=extend.none)

//     // Create a box to fill the background between the red and green lines
//     if bgcolorEnabled
//         box.new(left=bar_index[2], top=patternHigh, right=future_bar_index_lines, bottom=patternLow, bgcolor=bgcolorColor)

// -------------------------------------------------------------------------
// Strategy Entry and Exit Parameters
// -------------------------------------------------------------------------

// Input parameters for stop loss
longStopLoss = input.float(1.0, title="Long Stop Loss (%)", minval=0.1)  // Percentage-based stop loss for long
shortStopLoss = input.float(1.0, title="Short Stop Loss (%)", minval=0.1)  // Percentage-based stop loss for short

// Variable to track if a trade has been taken
var bool tradeTaken = false

// Reset the flag when a new Shark-32 pattern is confirmed
if shark32
    tradeTaken := false

// Entry conditions only trigger after the Shark-32 is confirmed
longCondition = ta.crossover(close, patternHigh) and not tradeTaken  // Long entry when close crosses above locked patternHigh
shortCondition = ta.crossunder(close, patternLow) and not tradeTaken  // Short entry when close crosses below locked patternLow

// Trigger long and short trades based on the crossover conditions
if (longCondition)
    label.new(bar_index, high, "Long Trigger", style=label.style_label_down, color=color.green, textcolor=color.white, size=size.small)
    strategy.entry("Shark-32 Long", strategy.long)
    tradeTaken := true  // Set the flag to true after a trade is taken

if (shortCondition)
    label.new(bar_index, low, "Short Trigger", style=label.style_label_up, color=color.red, textcolor=color.white, size=size.small)
    strategy.entry("Shark-32 Short", strategy.short)
    tradeTaken := true  // Set the flag to true after a trade is taken

// Exit long trade based on the upper target line (upper white dotted line) as take profit
if strategy.position_size > 0
    strategy.exit("Take Profit Long", "Shark-32 Long", limit=upperTarget, stop=close * (1 - longStopLoss / 100))

// Exit short trade based on the lower target line (lower white dotted line) as take profit
if strategy.position_size < 0
    strategy.exit("Take Profit Short", "Shark-32 Short", limit=lowerTarget, stop=close * (1 + shortStopLoss / 100))