高度な取引パターン認識と動的リスク管理戦略

EMA ATR FIBONACCI ENGULFING volatility VOLUME RISK-REWARD
作成日: 2025-06-19 13:57:50 最終変更日: 2025-06-19 13:57:50
コピー: 4 クリック数: 287
2
フォロー
319
フォロワー

高度な取引パターン認識と動的リスク管理戦略 高度な取引パターン認識と動的リスク管理戦略

戦略概要

高級取引パターン認識と動的リスク管理戦略は,精密な吸収形態認識技術と動的リスク管理システムを融合した量化取引戦略である.この戦略の核心は,高度な数学的検証方法によって市場内の吸収形態を正確に識別することであり,50周期指数移動平均 ((EMA)) をトレンドフィルターとして組み合わせ,取引方向が主要市場トレンドと一致していることを確認することである.この戦略は,深度分析のチャート,取引量確認,および波動性のフィルタリングなどの多重技術指標を出し,高い確率の取引シグナルを出し,同時にフィーナポッチレベルの動的止損と利益目標に基づいて,インテリジェントリスク管理を実現する.

戦略原則

この戦略は,いくつかの重要な要素の協同作業に基づいています.

  1. トレンド認識システム:50サイクルEMAを主要トレンド指標として使用する.価格がEMA上部にあると上昇トレンドとして認識され,多額の取引に適している.価格がEMA下部にあると下部トレンドとして認識され,空白に適している.これは,取引が常に市場主導の方向に従っていることを保証する.

  2. 高度な吞食形態認識戦略: 強化版の吞食形態を検知し,現在のが前のを完全に”吞食”することを要求し,形質の質を数学的に検証する. システムは分析する:

    • 前の体に対する現在の体比 ((最小の吸収比))
    • 上下影線と実体との比率 ((最大影線比率)
    • 現在のの総サイズと平均実範囲 ((ATR)) の関係
  3. 複数のフィルタリング

    • 取引量フィルター:取引量が平均値の特定の倍数を超えていることを確認する
    • 波動性フィルター:ATRによる市場波動性が適切な取引条件に達していることを確認する
    • 影線質量制御:上下影線サイズを制限し,信号品質を向上させる
  4. ダイナミックなリスク管理

    • ストップ・ロズ計算:フィボナッチレベル,固定金額,ATR倍数に基づく複数のストップ・ロズ戦略をサポート
    • 収益目標: 固定リスク・リターン比率またはフィボナッチレベルでの目標設定
    • 取引費用を自動計算し,実際の取引環境で戦略の実行性を確保する

戦略的優位性

この戦略は,コードを深く分析した結果,以下のような顕著な利点を示しています.

  1. 正確な入学時間戦略は,傾向,形状,複数の確認指標を組み合わせることで,統計学的に優位な高品質の入場点を特定し,単一の指標によってもたらされる偽の信号を回避します.

  2. リスク管理に適応する固定パラメータの従来の戦略とは異なり,この戦略のリスク管理システムは,現在の市場条件に動的に調整され,フィボナッチレベルまたはATR値を使用して,ストップ損失と利益の目標を計算し,異なる市場環境により適しています.

  3. 完全なビジュアルサポート戦略は,入場シグナル,ストップ/利益レベル,現在のトレンド状態,リアルタイムP&Lの追跡を含む,完全なグラフマークと情報パネルを提供し,トレーダーが市場状況と戦略のパフォーマンスを直観的に理解するのを助けます.

  4. 高度なカスタマイズ性戦略は,EMAの長さ,吸収率,リスク・リターン比率などを含む豊富なパラメータの設定を提供します.これは,トレーダーが個人リスクの好みや異なる市場状況に応じて戦略のパフォーマンスを調整できるようにします.

  5. 統合取引費用の考慮戦略の内蔵取引手数料の計算は,多くの取引システムがしばしば無視する重要な要素であり,実際の取引環境に近い結果が確認されます.

戦略リスク

この戦略は複数の利点があるものの,以下の潜在的なリスクと限界があります.

  1. 市場環境への依存策略は,傾向がはっきりした市場で最適で,横横整理または高波動の無方向性のある市場でより多くの偽信号を生成する可能性があります. 策略を使用する前に,より高いタイムフレームの市場の状態を評価するか,または追加の市場構造フィルターを追加する方法を解決します.

  2. パラメータ最適化トラップ: 過度な最適化パラメータは,曲線適合につながり,将来の市場環境で不良なパフォーマンスを発揮する.パラメータの有効性を検証するために,前向きテストまたは異なる市場条件下での安定性テストを使用することを推奨する.

  3. 破綻のリスクを抑える: 極端な市場の変動や流動性の欠如の条件下では,実際のストップは,予想される損失を超えて滑りやすい. ストップのバッファーを増やすか,より保守的なポジションサイズを使用することによって,このリスクを軽減することができます.

  4. 技術指標の遅れ:EMAおよびその他の技術指標は,本質的に遅滞しており,市場の急速な変化に反応しなくなる可能性があります.より高いタイムフレーム分析または早期警告指標の追加により,この欠陥を補うことをお勧めします.

  5. 取引量と品質の問題: 戦略は取引量構造や品質ではなく,取引量の大きさだけを考慮し,特定の市場条件下では誤導的になる可能性があります.取引量分布分析または資金流向指標の深さを増やすことを考慮して取引量分析を強化することができます.

戦略最適化の方向性

この戦略は,以下の方向から最適化できます.

  1. 市場が適応する

    • 市場構造の識別機能を実現し,トレンドと区間市場で異なるパラメータセットを使用する
    • 市場波動率指数 (VIX) または他の市場情緒指標を導入し,波動が激しい時期にリスクパラメータを自動的に調整する
    • 理由: 戦略が異なる市場環境に賢く適応し,全体的な安定性を高める
  2. 多時間枠分析

    • トレンド確認メカニズムは,より高いタイムフレームに追加されます.
    • 低タイムフレームを使用して入場精度を最適化
    • 理由: 多時間枠分析により,トレンドの認識の精度が大幅に向上し,逆転取引が減少する
  3. 高級取引量分析

    • トレンド確認の追加として,取引量加重移動平均 ((VWMA) を導入
    • 総取引量ではなく,買取圧力分析
    • 理由は,より細かい取引量分析により,市場参加者の行動に関するより深い洞察が得られるからです.
  4. 機械学習の強化

    • 単純な機械学習アルゴリズムを使用してパラメータを自動最適化
    • 歴史的なデータに基づいて最も適した吞食形態の特徴
    • 理由は,機械学習が人間には見えない微妙なパターンや関連性を認識できるからです.
  5. リスク管理の強化

    • アカウントの純額に基づく動的ポジション規模調整を実現する
    • 日/週/月のリスク制限を追加
    • ブレイク・イヴ機能の導入
    • 理由は,より高度なリスク管理が,長期的な取引の成功の基盤であるからです.

要約する

高級取引パターンの識別と動的リスク管理戦略は,従来型の吸収形状分析と近代的な量化方法を融合させることで,包括的な取引枠組みを作成する精巧に設計された取引システムである.この戦略の核心的な優点は,その多次元的な信号確認機構と適応性のリスク管理システムであり,異なる市場条件下で比較的安定したパフォーマンスを維持することができます.

戦略は50EMAのトレンドフィルター,高度な吞食形態の識別,取引量,および波動性の確認などの複数のメカニズムにより,入場信号の質を大幅に向上させています.同時に,フィボナッチレベルまたはATR倍数による動的止損と利益の目標により,取引ごとに明確なリスクと報酬の構造を提供します.

市場環境依存性や技術指標の遅れなどの固有の限界があるにもかかわらず,市場状態の自己適応,マルチタイムフレーム分析,機械学習の強化などの推奨された最適化方向によって,この戦略は,その安定性と適応性をさらに向上させる可能性がある. 経験のあるトレーダーにとって,これは全面的な機能を提供するプロレベルの取引システムであり,新入者には,高度な取引概念とリスク管理の原則を学ぶための教育ツールとして使用できます.

ストラテジーソースコード
/*backtest
start: 2025-05-19 00:00:00
end: 2025-06-18 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=6
strategy("🎯 IKODO Engulfing Strategy with Dynamic RR & Commission", shorttitle="IKODO Engulfing Pro", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10, pyramiding=0, calc_on_every_tick=false, calc_on_order_fills=false, commission_type=strategy.commission.percent, commission_value=0.04)

// ═══════════════════════════════════════════════════════════════════════════════
// 📊 ADVANCED INPUT PARAMETERS
// ═══════════════════════════════════════════════════════════════════════════════

// Commission Settings
enable_commission = input.bool(true, "Enable Commission", group="💰 Commission Settings")
commission_rate = input.float(0.04, "Commission Rate (%)", minval=0.0, maxval=1.0, step=0.01, group="💰 Commission Settings", tooltip="Binance Futures: 0.02% Maker, 0.04% Taker")
commission_type_input = input.string("Percentage", "Commission Type", options=["Percentage", "Fixed USD"], group="💰 Commission Settings")

// Risk Management Inputs
rr_ratio = input.float(2.0, "Risk Reward Ratio", minval=0.5, maxval=10.0, step=0.1, group="🎯 Risk Management")
use_fibonacci_tp = input.bool(true, "Use Fibonacci Levels for TP", group="🎯 Risk Management")
fib_level_tp = input.float(0.618, "Fibonacci Level for TP", minval=0.236, maxval=1.0, step=0.001, group="🎯 Risk Management")

// Stop Loss Settings
sl_type = input.string("Fibonacci", "Stop Loss Type", options=["Fibonacci", "Fixed USD", "ATR Multiple"], group="🛡️ Stop Loss Settings")
sl_fib_level = input.float(0.236, "Fibonacci Level for SL", minval=0.1, maxval=0.5, step=0.001, group="🛡️ Stop Loss Settings")
sl_fixed_usd = input.float(50.0, "Fixed Stop Loss (USD)", minval=1.0, maxval=1000.0, step=1.0, group="🛡️ Stop Loss Settings")
sl_atr_multiple = input.float(1.5, "ATR Multiple for SL", minval=0.5, maxval=5.0, step=0.1, group="🛡️ Stop Loss Settings")

// EMA Settings
ema_length = input.int(50, "EMA Length", minval=1, maxval=200, group="📈 Trend Filter")
ema_source = input.source(close, "EMA Source", group="📈 Trend Filter")

// Pattern Recognition Settings
min_engulf_ratio = input.float(0.1, "Minimum Engulfing Ratio", minval=0.01, maxval=1.0, step=0.01, group="🔍 Pattern Recognition")
max_wick_ratio = input.float(0.3, "Maximum Wick Ratio", minval=0.1, maxval=0.8, step=0.01, group="🔍 Pattern Recognition")

// Advanced Filters
volume_filter = input.bool(true, "Use Volume Filter", group="🔧 Advanced Filters")
volume_multiplier = input.float(1.2, "Volume Multiplier", minval=1.0, maxval=3.0, step=0.1, group="🔧 Advanced Filters")
atr_filter = input.bool(true, "Use ATR Volatility Filter", group="🔧 Advanced Filters")
atr_length = input.int(14, "ATR Length", minval=1, maxval=50, group="🔧 Advanced Filters")
min_atr_ratio = input.float(0.5, "Minimum ATR Ratio", minval=0.1, maxval=2.0, step=0.1, group="🔧 Advanced Filters")

// Visualization Settings
show_fibonacci_levels = input.bool(true, "Show Fibonacci Levels", group="🎨 Visualization")

// ═══════════════════════════════════════════════════════════════════════════════
// 🧮 QUANTITATIVE CALCULATIONS
// ═══════════════════════════════════════════════════════════════════════════════

// EMA Calculation
ema_50 = ta.ema(ema_source, ema_length)

// ATR for Volatility Assessment
atr = ta.atr(atr_length)

// Volume Analysis
avg_volume = ta.sma(volume, 20)
volume_condition = not volume_filter or volume > avg_volume * volume_multiplier

// Fibonacci calculation for swing levels
swing_high = ta.highest(high, 20)
swing_low = ta.lowest(low, 20)

// ═══════════════════════════════════════════════════════════════════════════════
// 🔍 ADVANCED PATTERN RECOGNITION
// ═══════════════════════════════════════════════════════════════════════════════

// Current and Previous Candle Properties
curr_body = math.abs(close - open)
prev_body = math.abs(close[1] - open[1])
curr_range = high - low
prev_range = high[1] - low[1]

// Candle Color Identification
curr_bullish = close > open
curr_bearish = close < open
prev_bullish = close[1] > open[1]
prev_bearish = close[1] < open[1]

// Enhanced Engulfing Pattern Detection
bullish_engulfing = curr_bullish and prev_bearish and close > high[1] and low < low[1] and curr_body > prev_body * min_engulf_ratio

bearish_engulfing = curr_bearish and prev_bullish and close < low[1] and high > high[1] and curr_body > prev_body * min_engulf_ratio

// Wick Analysis for Quality Filter
curr_upper_wick = curr_bullish ? high - close : high - open
curr_lower_wick = curr_bullish ? open - low : close - low
wick_filter_long = curr_upper_wick <= curr_range * max_wick_ratio
wick_filter_short = curr_lower_wick <= curr_range * max_wick_ratio

// ATR Volatility Filter
atr_filter_condition = not atr_filter or curr_range >= atr * min_atr_ratio

// ═══════════════════════════════════════════════════════════════════════════════
// 📈 TREND ANALYSIS & ENTRY CONDITIONS
// ═══════════════════════════════════════════════════════════════════════════════

// Trend Conditions
uptrend = close > ema_50
downtrend = close < ema_50

// Complete Entry Conditions
long_condition = uptrend and bullish_engulfing and wick_filter_long and volume_condition and atr_filter_condition

short_condition = downtrend and bearish_engulfing and wick_filter_short and volume_condition and atr_filter_condition

// ═══════════════════════════════════════════════════════════════════════════════
// 🎯 ADVANCED STOP LOSS CALCULATION
// ═══════════════════════════════════════════════════════════════════════════════

// Function to calculate stop loss based on type
calculate_stop_loss(entry_price, is_long, sl_type, swing_high, swing_low, atr, sl_fib_level, sl_fixed_usd, sl_atr_multiple) =>
    var float stop_loss = na
    
    if sl_type == "Fibonacci"
        if is_long
            fib_range = swing_high - swing_low
            stop_loss := swing_low + (fib_range * sl_fib_level)
        else
            fib_range = swing_high - swing_low
            stop_loss := swing_high - (fib_range * sl_fib_level)
    
    else if sl_type == "Fixed USD"
        if is_long
            stop_loss := entry_price - sl_fixed_usd
        else
            stop_loss := entry_price + sl_fixed_usd
    
    else if sl_type == "ATR Multiple"
        if is_long
            stop_loss := entry_price - (atr * sl_atr_multiple)
        else
            stop_loss := entry_price + (atr * sl_atr_multiple)
    
    stop_loss

// Function to calculate take profit
calculate_take_profit(entry_price, stop_loss, is_long, use_fibonacci_tp, swing_high, swing_low, fib_level_tp, rr_ratio) =>
    var float take_profit = na
    
    if use_fibonacci_tp
        if is_long
            fib_range = swing_high - swing_low
            take_profit := swing_low + (fib_range * fib_level_tp)
        else
            fib_range = swing_high - swing_low
            take_profit := swing_high - (fib_range * fib_level_tp)
    else
        // Traditional RR-based TP
        if is_long
            risk = entry_price - stop_loss
            take_profit := entry_price + (risk * rr_ratio)
        else
            risk = stop_loss - entry_price
            take_profit := entry_price - (risk * rr_ratio)
    
    take_profit

// ═══════════════════════════════════════════════════════════════════════════════
// 🎯 DYNAMIC RISK MANAGEMENT SYSTEM
// ═══════════════════════════════════════════════════════════════════════════════

// Dynamic Stop Loss and Take Profit Calculation
var float entry_price = na
var float stop_loss = na
var float take_profit = na
var float commission_cost = na

if long_condition and strategy.position_size == 0
    entry_price := close
    stop_loss := calculate_stop_loss(entry_price, true, sl_type, swing_high, swing_low, atr, sl_fib_level, sl_fixed_usd, sl_atr_multiple)
    take_profit := calculate_take_profit(entry_price, stop_loss, true, use_fibonacci_tp, swing_high, swing_low, fib_level_tp, rr_ratio)
    
    // Calculate commission cost
    commission_cost := enable_commission and commission_type_input == "Fixed USD" ? sl_fixed_usd * 2 : 0

if short_condition and strategy.position_size == 0
    entry_price := close
    stop_loss := calculate_stop_loss(entry_price, false, sl_type, swing_high, swing_low, atr, sl_fib_level, sl_fixed_usd, sl_atr_multiple)
    take_profit := calculate_take_profit(entry_price, stop_loss, false, use_fibonacci_tp, swing_high, swing_low, fib_level_tp, rr_ratio)
    
    // Calculate commission cost
    commission_cost := enable_commission and commission_type_input == "Fixed USD" ? sl_fixed_usd * 2 : 0

// ═══════════════════════════════════════════════════════════════════════════════
// 🚀 STRATEGY EXECUTION WITH COMMISSION
// ═══════════════════════════════════════════════════════════════════════════════

// Entry Orders
if long_condition
    strategy.entry("Long", strategy.long, comment="🟢 Elite Long Entry")

if short_condition
    strategy.entry("Short", strategy.short, comment="🔴 Elite Short Entry")

// Exit Orders
if strategy.position_size > 0
    strategy.exit("Long Exit", "Long", stop=stop_loss, limit=take_profit, comment="🎯 Long Exit")

if strategy.position_size < 0
    strategy.exit("Short Exit", "Short", stop=stop_loss, limit=take_profit, comment="🎯 Short Exit")

// ═══════════════════════════════════════════════════════════════════════════════
// 📊 ADVANCED VISUALIZATION - GLOBAL SCOPE
// ═══════════════════════════════════════════════════════════════════════════════

// EMA Plot
plot(ema_50, "EMA 50", color=color.new(color.blue, 0), linewidth=2)

// Entry Signals
plotshape(long_condition, "Long Signal", shape.triangleup, location.belowbar, color.new(color.green, 0), size=size.normal)
plotshape(short_condition, "Short Signal", shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.normal)

// Support/Resistance Levels
plot(strategy.position_size != 0 ? stop_loss : na, "Stop Loss", color.new(color.red, 0), linewidth=2, style=plot.style_linebr)
plot(strategy.position_size != 0 ? take_profit : na, "Take Profit", color.new(color.green, 0), linewidth=2, style=plot.style_linebr)

// Entry Price Line
plot(strategy.position_size != 0 ? entry_price : na, "Entry Price", color.new(color.yellow, 0), linewidth=1, style=plot.style_linebr)

// Fibonacci Levels Visualization - MOVED TO GLOBAL SCOPE
show_fib_condition = show_fibonacci_levels and (sl_type == "Fibonacci" or use_fibonacci_tp)
plot(show_fib_condition ? swing_high : na, "Swing High", color.new(color.gray, 50), linewidth=1, style=plot.style_circles)
plot(show_fib_condition ? swing_low : na, "Swing Low", color.new(color.gray, 50), linewidth=1, style=plot.style_circles)

// Additional Fibonacci Levels
fib_range = swing_high - swing_low
fib_236 = swing_low + (fib_range * 0.236)
fib_382 = swing_low + (fib_range * 0.382)
fib_618 = swing_low + (fib_range * 0.618)
fib_786 = swing_low + (fib_range * 0.786)

plot(show_fib_condition ? fib_236 : na, "Fib 23.6%", color.new(color.orange, 70), linewidth=1, style=plot.style_linebr)
plot(show_fib_condition ? fib_382 : na, "Fib 38.2%", color.new(color.orange, 70), linewidth=1, style=plot.style_linebr)
plot(show_fib_condition ? fib_618 : na, "Fib 61.8%", color.new(color.orange, 70), linewidth=1, style=plot.style_linebr)
plot(show_fib_condition ? fib_786 : na, "Fib 78.6%", color.new(color.orange, 70), linewidth=1, style=plot.style_linebr)

// ═══════════════════════════════════════════════════════════════════════════════
// 📈 ENHANCED PERFORMANCE METRICS DISPLAY
// ═══════════════════════════════════════════════════════════════════════════════

// Enhanced Information Table
var table info_table = table.new(position.top_right, 3, 12, bgcolor=color.new(color.white, 85), border_width=1)

if barstate.islast
    table.cell(info_table, 0, 0, "📊 ELITE STRATEGY PRO", text_color=color.black, text_size=size.small)
    
    // Risk Management Info
    table.cell(info_table, 0, 1, "Risk-Reward Ratio:", text_color=color.black, text_size=size.tiny)
    table.cell(info_table, 1, 1, str.tostring(rr_ratio, "#.##"), text_color=color.blue, text_size=size.tiny)
    
    // Commission Info
    table.cell(info_table, 0, 2, "Commission:", text_color=color.black, text_size=size.tiny)
    commission_text = enable_commission ? (commission_type_input == "Percentage" ? str.tostring(commission_rate, "#.##") + "%" : "$" + str.tostring(sl_fixed_usd, "#.##")) : "Disabled"
    table.cell(info_table, 1, 2, commission_text, text_color=enable_commission ? color.red : color.gray, text_size=size.tiny)
    
    // Stop Loss Type
    table.cell(info_table, 0, 3, "Stop Loss Type:", text_color=color.black, text_size=size.tiny)
    table.cell(info_table, 1, 3, sl_type, text_color=color.purple, text_size=size.tiny)
    
    // EMA Period
    table.cell(info_table, 0, 4, "EMA Period:", text_color=color.black, text_size=size.tiny)
    table.cell(info_table, 1, 4, str.tostring(ema_length), text_color=color.blue, text_size=size.tiny)
    
    // Current Trend
    table.cell(info_table, 0, 5, "Current Trend:", text_color=color.black, text_size=size.tiny)
    trend_text = uptrend ? "🟢 BULLISH" : downtrend ? "🔴 BEARISH" : "⚪ NEUTRAL"
    trend_color = uptrend ? color.green : downtrend ? color.red : color.gray
    table.cell(info_table, 1, 5, trend_text, text_color=trend_color, text_size=size.tiny)
    
    // ATR
    table.cell(info_table, 0, 6, "ATR:", text_color=color.black, text_size=size.tiny)
    table.cell(info_table, 1, 6, str.tostring(atr, "#.####"), text_color=color.blue, text_size=size.tiny)
    
    // Fibonacci Range
    table.cell(info_table, 0, 7, "Fib Range:", text_color=color.black, text_size=size.tiny)
    table.cell(info_table, 1, 7, str.tostring(fib_range, "#.####"), text_color=color.orange, text_size=size.tiny)
    
    // Current Position Info
    if strategy.position_size != 0
        current_pnl = strategy.position_size > 0 ? (close - entry_price) / entry_price * 100 : (entry_price - close) / entry_price * 100
        table.cell(info_table, 0, 8, "Current P&L:", text_color=color.black, text_size=size.tiny)
        pnl_color = current_pnl > 0 ? color.green : color.red
        table.cell(info_table, 1, 8, str.tostring(current_pnl, "#.##") + "%", text_color=pnl_color, text_size=size.tiny)
        
        // Risk Amount
        risk_amount = strategy.position_size > 0 ? entry_price - stop_loss : stop_loss - entry_price
        table.cell(info_table, 0, 9, "Risk per Share:", text_color=color.black, text_size=size.tiny)
        table.cell(info_table, 1, 9, str.tostring(risk_amount, "#.####"), text_color=color.orange, text_size=size.tiny)
        
        // Reward Amount
        reward_amount = strategy.position_size > 0 ? take_profit - entry_price : entry_price - take_profit
        table.cell(info_table, 0, 10, "Reward per Share:", text_color=color.black, text_size=size.tiny)
        table.cell(info_table, 1, 10, str.tostring(reward_amount, "#.####"), text_color=color.green, text_size=size.tiny)

// ═══════════════════════════════════════════════════════════════════════════════
// 🔔 ENHANCED ALERT CONDITIONS
// ═══════════════════════════════════════════════════════════════════════════════

// Alert conditions
alertcondition(long_condition, title="🟢 Elite Long Entry Pro", message="Elite Engulfing Strategy PRO: LONG signal detected with commission calculation.")

alertcondition(short_condition, title="🔴 Elite Short Entry Pro", message="Elite Engulfing Strategy PRO: SHORT signal detected with commission calculation.")

// Dynamic alerts with detailed information
if long_condition
    alert_msg = "🟢 LONG SIGNAL: Elite Engulfing Pro | Price: " + str.tostring(close, "#.####") + " | RR: " + str.tostring(rr_ratio, "#.##") + " | SL Type: " + sl_type + " | Commission: " + (enable_commission ? str.tostring(commission_rate, "#.##") + "%" : "Disabled")
    alert(alert_msg, alert.freq_once_per_bar)

if short_condition
    alert_msg = "🔴 SHORT SIGNAL: Elite Engulfing Pro | Price: " + str.tostring(close, "#.####") + " | RR: " + str.tostring(rr_ratio, "#.##") + " | SL Type: " + sl_type + " | Commission: " + (enable_commission ? str.tostring(commission_rate, "#.##") + "%" : "Disabled")
    alert(alert_msg, alert.freq_once_per_bar)