二重指数移動平均バウンスモメンタム取引戦略

EMA SL TP R:R 趋势一致性 反弹交易 动量交易 风险管理 蜡烛图形态
作成日: 2025-06-03 10:59:06 最終変更日: 2025-06-03 10:59:06
コピー: 0 クリック数: 281
2
フォロー
319
フォロワー

二重指数移動平均バウンスモメンタム取引戦略 二重指数移動平均バウンスモメンタム取引戦略

概要

この戦略は,双指数移動平均線 (EMA) が形成された価格を利用して,高確率の反転の機会を識別する.これは単純な平均線を横断する戦略ではなく,価格がEMAから反発し,強力な動きを形成する時間を探す戦略である.この戦略は,取引区間を構成するために12周期および21周期のEMAを使用し,図形状,トレンド一致性,正確なリスク管理システムと組み合わせて,市場の動きを捕捉する.

戦略原則

この戦略の核心原則は,価格がEMAから反発した状況を認識することによって入場シグナルを探すことである. 12サイクルおよび21サイクルEMAを使用して,上下取引帯を作成し,EMAの相対的な位置に基づいて市場のトレンド方向を決定する.

EMA12 > EMA21で,市場は看板の環境 ((緑の帯) にあり,我々は多くの機会を探している. 複数の条件:価格の下の影線はEMA帯に触れて,強い看板を形成する ((下の影線より大きい実体),上影線は最小化する ((の範囲の2%未満),閉盤価格は2つのEMAより高く,前の一は下帯の下には収まらない,そして,いくつかの連續根は,看板の傾向を一貫して維持する.

EMA12 < EMA21 のとき,市場は下落の環境 ((赤帯) にあり,空調の機会を探します.空調の条件は,価格の上影線がEMA帯に触れて,強い下落のを形成し ((上影線より大きい実体),下影線を最小化し ((の範囲の2%未満),閉盘価格が2つのEMAを下回り,前一は上帯の上に収束せず,そして,連続していくつかの根は下落の傾向を一貫して維持する.

策略内蔵の固定リスク・リターン比のリスク管理システムで,デフォルトで 3:1,ストップロスは前回の高点/低点に設定され,ストップはリスク・リターン比に基づいて自動的に計算される.

戦略的優位性

この戦略にはいくつかの大きな利点があります.

  1. 高勝率ポテンシャル:この戦略は,EMA帯の反発後の強力な動力の動きを捉えることで,成功する可能性が高い取引機会を識別できます.

  2. 明確な入場・出場ルール: 戦略は取引条件を明確にし,主観的な判断や感情的な意思決定の影響を軽減します.

  3. 優れたリスク管理: 固定されたリスク/報酬比率と自動ストップ・ストップの設定により,各取引のリスクがコントロールされていることを保証します.

  4. トレンドは優位に追随する: トレンドを主導する方向でのみ取引する戦略で,逆行操作の高リスクを避ける.

  5. 複数のタイムサイクルに適用可能:この戦略は,様々なタイムサイクルで有効に動作し,柔軟な取引オプションを提供します.

  6. 全面的な提醒システム: 詳細な取引シグナルを内蔵した提醒機能で,取引の機会を逃さないようにします.

  7. ビジュアルアシスト:背景の色変化とラベルの提示によって,取引信号と条件の状態を直視的に表示する.

戦略リスク

この戦略の設計は精巧ですが,以下の潜在的なリスクがあります.

  1. 振動市場リスク:横盤または振動市場では,EMA帯は緊密になり,頻繁な,しかし低品質な信号を生み出し,連続したストップを起こす可能性があります.

  2. 激情跳躍のリスク:重要なニュースやイベントの後に市場が跳躍し,ストップポイントを無効にし,予想以上の損失を引き起こす可能性があります.

  3. パラメータ過度最適化:戦略のパラメータを過度最適化すると,曲線フィットが起こり,戦略が実盤取引で不良なパフォーマンスを発揮する可能性があります.

  4. トレンド認識の遅延: EMAは遅滞の指標として,トレンドの転換点では反応が遅い可能性があり,最適なエントリーポイントを逃すか,退出を遅らせます.

  5. ストップ・損失を誘発するリスク:市場の騒音により,ストップ・損失が誘発された後,価格が予想方向に戻り,不必要な損失を発生させる可能性があります.

解決策には,波動的な市場での取引を一時停止すること,波動率フィルターを使用して低品質の信号を回避すること,他の指標と組み合わせてトレンドを確認すること,定期的な反測定と最適化パラメータを行うこと,トラッキングストップを使用することを考慮することです.

戦略最適化の方向性

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

  1. ダイナミックなリスク管理:市場の変動に応じてリスクリターン比率とポジションのサイズを自動的に調整し,高波動環境下ではリスクの門檻を低減する.

  2. 高級フィルター導入:ATR ((平均リアル波幅) 指標を組み合わせて低波動期の信号をフィルターする;取引量確認を加え,価格反発の有効性を検証する.

  3. 多時間周期分析:より高い時間周期のトレンド方向を統合する追加のフィルタリング条件として,複数の時間周期のトレンドが一致する場合にのみ参加する.

  4. 機械学習最適化:機械学習アルゴリズムを使用してパラメータを動的に調整し,異なる市場環境に応じて最適なパラメータの組み合わせに自律的に適応する.

  5. トラッキング・ストップ・リエクティベーション:収益が一定のレベルに達した後に,トラッキング・ストップ・メカニズムを導入し,利益の一部をロックしながら,トレンドの継続を許可する.

  6. 部分利益戦略: 利益戦略の実施,異なる目標価格で徐々に減仓し,全体のリスク・リターンのパフォーマンスを最適化する.

これらの最適化方向は,戦略の安定性,適応性,そして長期的な収益性を向上させることができます.

要約する

双指数移動均線帯反弹動量取引戦略は,技術分析,グラフ形状の識別,および厳格なリスク管理を組み合わせた総合的な取引システムである.それは,価格がEMA帯から反弹する高確率の反転点を識別することによって,爆発的な動量を持つ市場機会を捕捉する.この戦略の核心的な優位性は,明確な取引ルール,固定的リスク・リターン・フレームワーク,およびトレンド一致性の要求であり,さまざまな市場環境と周期時間に対応する.

いくつかの潜在的なリスクがあるにもかかわらず,推奨された最適化措置を適用することにより,トレーダーは戦略の安定性と収益性をさらに向上させることができます. この戦略は,短線または中長期の投資家が,システム化された,規律化された,リスク管理可能な取引方法を求めるトレーダーに特に適しています.

ストラテジーソースコード
/*backtest
start: 2025-05-26 00:00:00
end: 2025-06-02 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=5
strategy("Enhanced EMA Band Rejection Strategy", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// Input parameters
ema12_length = input.int(12, title="EMA 12 Length")
ema21_length = input.int(21, title="EMA 21 Length")
max_wick_percent = input.float(2.0, title="Max Wick % at High/Low", minval=0.0, maxval=10.0)
risk_reward_ratio = input.float(3.0, title="Risk/Reward Ratio (R)", minval=1.0, maxval=10.0)
trend_consistency_bars = input.int(5, title="Trend Consistency Required (Bars)", minval=1, maxval=20)

// Notification Settings
enable_notifications = input.bool(true, title="Enable Notifications", group="Notifications")
notify_on_entry = input.bool(true, title="Notify on Trade Entry", group="Notifications")
notify_on_exit = input.bool(true, title="Notify on Trade Exit", group="Notifications")
notify_on_setup = input.bool(false, title="Notify on Potential Setup (Pre-Entry)", group="Notifications")
notify_on_failed_conditions = input.bool(false, title="Notify on Failed Conditions", group="Notifications")

// Calculate EMAs
ema12 = ta.ema(close, ema12_length)
ema21 = ta.ema(close, ema21_length)

// Determine upper and lower EMA bands
ema_upper = math.max(ema12, ema21)
ema_lower = math.min(ema12, ema21)

// Plot EMAs
plot(ema12, color=color.blue, linewidth=2, title="EMA 12")
plot(ema21, color=color.red, linewidth=2, title="EMA 21")

// Calculate candle components
body_size = math.abs(close - open)
upper_wick = high - math.max(open, close)
lower_wick = math.min(open, close) - low
candle_range = high - low

// Calculate wick percentages
upper_wick_percent = candle_range > 0 ? (upper_wick / candle_range) * 100 : 0
lower_wick_percent = candle_range > 0 ? (lower_wick / candle_range) * 100 : 0

// Determine EMA trend direction
ema_bullish = ema12 > ema21  // Green bands - bullish trend
ema_bearish = ema12 < ema21  // Red bands - bearish trend

// Check trend consistency for required number of bars
bullish_consistency_check = true
bearish_consistency_check = true

for i = 0 to trend_consistency_bars - 1
    ema12_past = ta.ema(close[i], ema12_length)
    ema21_past = ta.ema(close[i], ema21_length)
    if ema12_past <= ema21_past
        bullish_consistency_check := false
    if ema12_past >= ema21_past
        bearish_consistency_check := false

// Final trend conditions with consistency requirement
ema_bullish_consistent = ema_bullish and bullish_consistency_check
ema_bearish_consistent = ema_bearish and bearish_consistency_check

// NEW RULE: Previous candle close position relative to bands
prev_close_above_upper_band = close[1] > ema_upper[1]
prev_close_below_lower_band = close[1] < ema_lower[1]
prev_close_within_bands = close[1] >= ema_lower[1] and close[1] <= ema_upper[1]

// Long setup conditions (only when EMAs are bullish/green consistently)
long_wick_condition = low <= ema_lower or (low <= ema_upper and low >= ema_lower)
long_body_condition = body_size >= lower_wick
long_wick_percent_condition = upper_wick_percent <= max_wick_percent
long_bullish_candle = close > open
long_trend_condition = ema_bullish_consistent  // Only long when bands are consistently green
long_close_above_bands = close > ema_upper  // NEW: Close must be above both EMAs
// Previous candle must not have closed below the lower band
long_prev_close_condition = not prev_close_below_lower_band
long_setup = long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and long_trend_condition and long_close_above_bands and long_prev_close_condition

// Short setup conditions (only when EMAs are bearish/red consistently)
short_wick_condition = high >= ema_upper or (high >= ema_lower and high <= ema_upper)
short_body_condition = body_size >= upper_wick
short_wick_percent_condition = lower_wick_percent <= max_wick_percent
short_bearish_candle = close < open
short_trend_condition = ema_bearish_consistent  // Only short when bands are consistently red
short_close_below_bands = close < ema_lower  // NEW: Close must be below both EMAs
// Previous candle must not have closed above the upper band
short_prev_close_condition = not prev_close_above_upper_band
short_setup = short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and short_trend_condition and short_close_below_bands and short_prev_close_condition

// Entry conditions
var float long_sl = na
var float short_sl = na
var float long_tp = na
var float short_tp = na

if long_setup and strategy.position_size == 0
    strategy.entry("Long", strategy.long)
    long_sl := low
    risk_amount = close - long_sl
    long_tp := close + (risk_amount * risk_reward_ratio)
    label.new(bar_index, low, "LONG", style=label.style_label_up, color=color.green, size=size.small)
    
    // Entry Notification
    if enable_notifications and notify_on_entry
        alert("🟢 LONG ENTRY SIGNAL\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Price: " + str.tostring(close, "#.####") + "\n" + 
              "Stop Loss: " + str.tostring(long_sl, "#.####") + "\n" + 
              "Take Profit: " + str.tostring(long_tp, "#.####") + "\n" + 
              "Risk/Reward: " + str.tostring(risk_reward_ratio, "#.##") + "R\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)

if short_setup and strategy.position_size == 0
    strategy.entry("Short", strategy.short)
    short_sl := high
    risk_amount = short_sl - close
    short_tp := close - (risk_amount * risk_reward_ratio)
    label.new(bar_index, high, "SHORT", style=label.style_label_down, color=color.red, size=size.small)
    
    // Entry Notification
    if enable_notifications and notify_on_entry
        alert("🔴 SHORT ENTRY SIGNAL\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Price: " + str.tostring(close, "#.####") + "\n" + 
              "Stop Loss: " + str.tostring(short_sl, "#.####") + "\n" + 
              "Take Profit: " + str.tostring(short_tp, "#.####") + "\n" + 
              "Risk/Reward: " + str.tostring(risk_reward_ratio, "#.##") + "R\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)

// Exit conditions with fixed R:R
if strategy.position_size > 0
    // Long position - fixed stop loss and take profit
    strategy.exit("Long Exit", "Long", stop=long_sl, limit=long_tp)
    
    // Exit Notifications
    if enable_notifications and notify_on_exit
        if close <= long_sl
            alert("🛑 LONG STOP LOSS HIT\n" + 
                  "Symbol: " + syminfo.ticker + "\n" + 
                  "Exit Price: " + str.tostring(close, "#.####") + "\n" + 
                  "Loss: " + str.tostring(close - strategy.position_avg_price, "#.####") + "\n" + 
                  "Time: " + str.tostring(time), alert.freq_once_per_bar)
        if close >= long_tp
            alert("🎯 LONG TAKE PROFIT HIT\n" + 
                  "Symbol: " + syminfo.ticker + "\n" + 
                  "Exit Price: " + str.tostring(close, "#.####") + "\n" + 
                  "Profit: " + str.tostring(close - strategy.position_avg_price, "#.####") + "\n" + 
                  "Time: " + str.tostring(time), alert.freq_once_per_bar)

if strategy.position_size < 0
    // Short position - fixed stop loss and take profit
    strategy.exit("Short Exit", "Short", stop=short_sl, limit=short_tp)
    
    // Exit Notifications
    if enable_notifications and notify_on_exit
        if close >= short_sl
            alert("🛑 SHORT STOP LOSS HIT\n" + 
                  "Symbol: " + syminfo.ticker + "\n" + 
                  "Exit Price: " + str.tostring(close, "#.####") + "\n" + 
                  "Loss: " + str.tostring(strategy.position_avg_price - close, "#.####") + "\n" + 
                  "Time: " + str.tostring(time), alert.freq_once_per_bar)
        if close <= short_tp
            alert("🎯 SHORT TAKE PROFIT HIT\n" + 
                  "Symbol: " + syminfo.ticker + "\n" + 
                  "Exit Price: " + str.tostring(close, "#.####") + "\n" + 
                  "Profit: " + str.tostring(strategy.position_avg_price - close, "#.####") + "\n" + 
                  "Time: " + str.tostring(time), alert.freq_once_per_bar)

// Plot stop levels and take profit levels
plot(strategy.position_size > 0 ? long_sl : na, color=color.red, linewidth=2, style=plot.style_line, title="Long SL")
plot(strategy.position_size < 0 ? short_sl : na, color=color.red, linewidth=2, style=plot.style_line, title="Short SL")
plot(strategy.position_size > 0 ? long_tp : na, color=color.green, linewidth=2, style=plot.style_line, title="Long TP")
plot(strategy.position_size < 0 ? short_tp : na, color=color.green, linewidth=2, style=plot.style_line, title="Short TP")

// Additional Notification Logic
// Potential Setup Notifications (when most conditions are met but not all)
long_potential_setup = long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and long_trend_condition and long_prev_close_condition and not long_close_above_bands
short_potential_setup = short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and short_trend_condition and short_prev_close_condition and not short_close_below_bands

if enable_notifications and notify_on_setup and strategy.position_size == 0
    if long_potential_setup
        alert("⚠️ POTENTIAL LONG SETUP\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Price: " + str.tostring(close, "#.####") + "\n" + 
              "Status: Close needs to be above " + str.tostring(ema_upper, "#.####") + "\n" + 
              "Current Close: " + str.tostring(close, "#.####") + "\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)
    
    if short_potential_setup
        alert("⚠️ POTENTIAL SHORT SETUP\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Price: " + str.tostring(close, "#.####") + "\n" + 
              "Status: Close needs to be below " + str.tostring(ema_lower, "#.####") + "\n" + 
              "Current Close: " + str.tostring(close, "#.####") + "\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)

// Failed Conditions Notifications (for debugging)
if enable_notifications and notify_on_failed_conditions and strategy.position_size == 0
    if long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and not long_trend_condition
        alert("❌ LONG SETUP FAILED\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Reason: " + (not ema_bullish ? "EMA trend bearish" : "EMA trend not consistent") + "\n" + 
              "EMA12: " + str.tostring(ema12, "#.####") + "\n" + 
              "EMA21: " + str.tostring(ema21, "#.####") + "\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)
    
    if short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and not short_trend_condition
        alert("❌ SHORT SETUP FAILED\n" + 
              "Symbol: " + syminfo.ticker + "\n" + 
              "Reason: " + (not ema_bearish ? "EMA trend bullish" : "EMA trend not consistent") + "\n" + 
              "EMA12: " + str.tostring(ema12, "#.####") + "\n" + 
              "EMA21: " + str.tostring(ema21, "#.####") + "\n" + 
              "Time: " + str.tostring(time), alert.freq_once_per_bar)
bgcolor(long_setup ? color.new(color.green, 90) : na, title="Long Setup")
bgcolor(short_setup ? color.new(color.red, 90) : na, title="Short Setup")
// Show when previous close condition fails
bgcolor(long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and long_trend_condition and prev_close_below_lower_band ? color.new(color.orange, 95) : na, title="Long Rejected by Prev Close")
bgcolor(short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and short_trend_condition and prev_close_above_upper_band ? color.new(color.orange, 95) : na, title="Short Rejected by Prev Close")

// Detailed debugging for failed conditions
long_all_conditions_except_prev = long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and long_trend_condition and long_close_above_bands
bgcolor(long_all_conditions_except_prev and prev_close_below_lower_band ? color.new(color.purple, 90) : na, title="Long Failed: Prev Close Below Band")
bgcolor(long_wick_condition and not long_body_condition ? color.new(color.yellow, 90) : na, title="Long Failed: Body Too Small")
bgcolor(long_wick_condition and long_body_condition and not long_wick_percent_condition ? color.new(color.blue, 90) : na, title="Long Failed: Upper Wick Too Big")
bgcolor(long_wick_condition and long_body_condition and long_wick_percent_condition and not long_bullish_candle ? color.new(color.gray, 90) : na, title="Long Failed: Not Bullish Candle")
bgcolor(long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and ema_bullish and not ema_bullish_consistent ? color.new(color.fuchsia, 90) : na, title="Long Failed: Trend Not Consistent")
bgcolor(long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and not ema_bullish ? color.new(color.maroon, 90) : na, title="Long Failed: EMA Trend Bearish")
bgcolor(long_wick_condition and long_body_condition and long_wick_percent_condition and long_bullish_candle and long_trend_condition and not long_close_above_bands ? color.new(color.lime, 90) : na, title="Long Failed: Close Not Above Bands")

// Similar debugging for shorts
short_all_conditions_except_prev = short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and short_trend_condition and short_close_below_bands
bgcolor(short_all_conditions_except_prev and prev_close_above_upper_band ? color.new(color.purple, 90) : na, title="Short Failed: Prev Close Above Band")
bgcolor(short_wick_condition and short_body_condition and short_wick_percent_condition and short_bearish_candle and short_trend_condition and not short_close_below_bands ? color.new(color.aqua, 90) : na, title="Short Failed: Close Not Below Bands")

// Enhanced table for debugging
if barstate.islast
    var table debug_table = table.new(position.top_right, 2, 19, bgcolor=color.white, border_width=1)
    table.cell(debug_table, 0, 0, "Condition", text_color=color.black, bgcolor=color.gray)
    table.cell(debug_table, 1, 0, "Value", text_color=color.black, bgcolor=color.gray)
    table.cell(debug_table, 0, 1, "Body Size", text_color=color.black)
    table.cell(debug_table, 1, 1, str.tostring(body_size, "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 2, "Upper Wick", text_color=color.black)
    table.cell(debug_table, 1, 2, str.tostring(upper_wick, "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 3, "Lower Wick", text_color=color.black)
    table.cell(debug_table, 1, 3, str.tostring(lower_wick, "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 4, "Upper Wick %", text_color=color.black)
    table.cell(debug_table, 1, 4, str.tostring(upper_wick_percent, "#.##") + "%", text_color=color.black)
    table.cell(debug_table, 0, 5, "Lower Wick %", text_color=color.black)
    table.cell(debug_table, 1, 5, str.tostring(lower_wick_percent, "#.##") + "%", text_color=color.black)
    table.cell(debug_table, 0, 6, "EMA Upper", text_color=color.black)
    table.cell(debug_table, 1, 6, str.tostring(ema_upper, "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 7, "EMA Lower", text_color=color.black)
    table.cell(debug_table, 1, 7, str.tostring(ema_lower, "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 8, "R:R Ratio", text_color=color.black)
    table.cell(debug_table, 1, 8, str.tostring(risk_reward_ratio, "#.##") + "R", text_color=color.black)
    table.cell(debug_table, 0, 9, "Position", text_color=color.black)
    table.cell(debug_table, 1, 9, strategy.position_size > 0 ? "LONG" : strategy.position_size < 0 ? "SHORT" : "NONE", text_color=color.black)
    // NEW DEBUG INFO
    table.cell(debug_table, 0, 10, "Prev Close", text_color=color.black)
    table.cell(debug_table, 1, 10, str.tostring(close[1], "#.##"), text_color=color.black)
    table.cell(debug_table, 0, 11, "Prev Above Upper", text_color=color.black)
    table.cell(debug_table, 1, 11, prev_close_above_upper_band ? "YES" : "NO", text_color=color.black)
    table.cell(debug_table, 0, 12, "Prev Below Lower", text_color=color.black)
    table.cell(debug_table, 1, 12, prev_close_below_lower_band ? "YES" : "NO", text_color=color.black)
    table.cell(debug_table, 0, 13, "Prev Within Bands", text_color=color.black)
    table.cell(debug_table, 1, 13, prev_close_within_bands ? "YES" : "NO", text_color=color.black)
    // NEW: Trend consistency info
    table.cell(debug_table, 0, 14, "Bullish Consistent", text_color=color.black)
    table.cell(debug_table, 1, 14, ema_bullish_consistent ? "YES" : "NO", text_color=color.black)
    table.cell(debug_table, 0, 15, "Bearish Consistent", text_color=color.black)
    table.cell(debug_table, 1, 15, ema_bearish_consistent ? "YES" : "NO", text_color=color.black)
    table.cell(debug_table, 0, 16, "Consistency Bars", text_color=color.black)
    table.cell(debug_table, 1, 16, str.tostring(trend_consistency_bars), text_color=color.black)
    // NEW: Close position relative to bands
    table.cell(debug_table, 0, 17, "Close Above Upper", text_color=color.black)
    table.cell(debug_table, 1, 17, close > ema_upper ? "YES" : "NO", text_color=color.black)
    table.cell(debug_table, 0, 18, "Close Below Lower", text_color=color.black)
    table.cell(debug_table, 1, 18, close < ema_lower ? "YES" : "NO", text_color=color.black)