다중 시간대 모멘텀 협력 거래 전략: EMA/MA/RSI를 통합한 양적 거래 시스템

EMA MA RSI ATR MTF
생성 날짜: 2025-03-25 14:18:20 마지막으로 수정됨: 2025-03-25 14:18:20
복사: 2 클릭수: 340
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

다중 시간대 모멘텀 협력 거래 전략: EMA/MA/RSI를 통합한 양적 거래 시스템 다중 시간대 모멘텀 협력 거래 전략: EMA/MA/RSI를 통합한 양적 거래 시스템

개요

다중주기동량협동거래전략은 기술지표와 다중주기분석을 결합한 양적거래시스템이다. 이전략의 핵심은 단기 ((15분) 과 장기 ((4시간) 시간주기의 시장운동을 동시에 모니터링하는 것이며, EMA ((지수 이동평균), MA (( 이동평균) 과 RSI ((대비적으로 강한 지표) 의 협동확인으로 위조신호를 필터링하고, 다중주기협동이 같은 방향으로 지향할 때만 거래한다. 이전략은 EMA 교차, 가격 돌파 및 RSI 동량확인 등 다중조건을 이용하여 거래확인으로 시장에 고품질의 진입신호를 제공한다. 또한, 이전 전략은 ATR ((평균 실제 파도) 에 기반한 동적손실 중지, 고정 스톱손실 비율 및 손해 추적 등의 위험관리 기능을 통합하여 하나의 완전한 거래시스템을 형성한다.

전략 원칙

이 전략의 핵심 원칙은 다중 기술 지표들을 여러 시간대에 걸쳐 종합적으로 분석하는 데 기초하고 있으며, 주로 다음과 같은 몇 가지 부분으로 나다.

  1. 다중 시간 주기 분석전략은 15분 (입장) 과 4시간 (향상 확인) 의 두 시간대를 동시에 분석하여 거래 방향이 더 큰 시장 추세와 일치하는지 확인합니다.

  2. 입학 조건 ((15분 주기):

    • 다중 입구: EMA13 > EMA62 ((단기 동력 호불호가 난다), 마감 가격 > MA200 ((가격은 주요 트렌드 라인 위에 있다), 빠른 RSI ((7) > 느린 RSI ((28) ((동력 증가), 빠른 RSI > 50 ((동력 편향 다중)), 거래량은 20주기 평균보다 크다.
    • 공백 입시: 다중 입시 조건과 달리, EMA13 < EMA62, 마감 가격 < MA200, 빠른 RSI(7) < 느린 RSI(28) 를 요구하며, 빠른 RSI < 50도 거래량을 증가시켜야 한다.
  3. 트렌드 확인 ((4시간 주기):

    • 다중 머리 확인: 15 분 주기 조건과 비슷하지만 RSI 요구 사항에서 약간 다르며, 느린 RSI > 40을 요구한다.
    • 공백 확인: 15 분 주기 조건과 마찬가지로, 느린 속도 RSI < 60 .
  4. 정확한 입학요건이 전략은 EMA13가 EMA62을 막 통과했거나, MA200을 막 통과했거나, 더 정확한 입시 지점을 제공하며, 이미 오래 지속된 추세에서 맹목적으로 입시하는 것을 피하는 것을 요구합니다.

  5. 탈퇴 장치: 기술 지표 반전 (EMA 관계 변화 또는 RSI가 과매매/ 과매매에 도달하는 경우), ATR 동적 스톱, 고정 비율 스톱 스톱 및 추적 스톱을 포함한 다양한 탈퇴 옵션이 제공됩니다.

전략적 이점

  1. 체계화된 다중 시간 주기 분석다양한 시기의 시장 상황을 종합적으로 분석함으로써, 전략은 단기 시장 소음을 필터링하고, 트렌드가 명확하고 일관된 경우에만 진입하여, 가짜 신호의 가능성을 크게 감소시킵니다.

  2. 다중 인증 메커니즘: EMA, MA, RSI 등 여러 지표의 협동 확인을 통해 거래 신호의 신뢰도를 높인다. 특히 EMA 교차 또는 가격 돌파구를 촉발 조건으로 요구하여 진입 시기의 정확도를 높인다.

  3. 유연한 위험 관리이 전략은 ATR 기반의 동적 스톱, 고정 비율 스톱 스톱 및 추적 스톱을 포함한 다양한 위험 관리 옵션을 제공하여 거래자가 개인 위험 선호도 및 시장 상황에 따라 위험 요소를 유연하게 조정할 수 있습니다.

  4. 양수 확인: 거래량이 증가하는 조건이 추가되어, 실제 가격 움직임은 거래량이 증가하는 것과 함께 있기 때문에, 가짜 돌파구를 더욱 필터링합니다.

  5. 시각화 인터페이스전략: 전략은 지표의 상태와 신호를 보여주는 직관적인 시각화 패널을 제공하여 거래자가 현재의 시장 상황과 전략 판단을 한눈에 볼 수 있도록합니다.

  6. 고도의 사용자 정의: 전략의 거의 모든 매개 변수들은 EMA 길이, MA 유형, RSI 매개 변수, 위험 제어 배수 등과 같은 입력 설정을 통해 조정할 수 있습니다. 이는 상인이 다른 시장 환경에 따라 전략을 최적화 할 수 있도록합니다.

전략적 위험

  1. 시장의 위기: 수평 변동 시장에서 EMA와 MA가 자주 교차하여 잘못된 신호가 증가하고 자주 거래되어 연속적인 손실이 발생합니다. 해결책은 변동률 판단이나 트렌드 강도 확인과 같은 추가적인 필터링 조건을 추가하여 변동 시장으로 명확하게 식별되면 거래를 중지하는 것입니다.

  2. 변수를 최적화합니다.과잉 최적화 지표 파라미터는 전략이 역사적인 데이터에서 우수한 성능을 발휘하지만 미래 시장에서 실패할 수 있습니다. 전략의 안정성을 검증하기 위해 Walk-Forward Analysis를 사용하는 것이 좋습니다.

  3. 큰 빈자 위험: 주요 뉴스 또는 갑작스러운 사건 후에 시장에서 큰 구멍이 발생할 수 있으며, 이로 인해 정지 손실이 미리 설정된 수준에서 실행되지 않습니다. 더 보수적인 포지션 관리 또는 변동율에 기반한 포지션 조정 메커니즘을 추가하는 것이 고려 될 수 있습니다.

  4. 수량적 지표에 의존하는 한계이 전략은 기술적인 지표에 전적으로 의존하여 기본적인 요소를 무시한다. 주요 경제 자료가 발표되거나 중앙은행 정책이 변경되기 전에, 거래의 중단이나 거래의 중단을 고려하여 갑작스러운 소식의 위험을 피할 수 있습니다.

  5. 신호 지연성EMA와 MA와 같은 지표는 본질적으로 지연성이 있으며, 트렌드가 종료되기 전에 신호를 발생시킬 수 있습니다. EMA 주기를 조정하거나 다른 전향적 지표 (예: 가격 형태 또는 변동률 변화) 와 결합하여 개선 할 수 있습니다.

전략 최적화 방향

  1. 시장 환경 필터에 가입하세요: 적응 지표 또는 시장 구조 판단을 도입하고, 전략을 실행하기 전에 현재 시장이 트렌드 시장인지 아니면 흔들림 시장인지 먼저 식별하고, 그에 따라 거래 매개 변수를 조정하거나 거래를 중지합니다. 예를 들어, ADX (평균 방향 지수) 를 사용하여 트렌드 강도를 정량화하고, 트렌드가 명확한 경우에만 거래 할 수 있습니다.

  2. 동적 변수 조정 메커니즘: 현재 전략은 고정된 기술 지표 매개 변수를 사용하며, 시장 변동률에 따라 자동 조정 매개 변수를 고려할 수 있습니다. 예를 들어, 낮은 변동률 환경에서 짧은 주기 EMA를 사용하여 빠르게 변동을 캡처하고, 높은 변동률 환경에서 긴 주기 EMA를 사용하여 소음을 줄입니다.

  3. 포지션 관리를 최적화: 현재 전략은 고정 비율 자금 관리를 사용하며, 변동률, 승률 예상 또는 케일리 공식에 기반한 동적 포지션 관리를 개선하여 위험 조정 후 수익을 극대화 할 수 있습니다.

  4. 기계 학습 요소를 추가합니다.: 결정 나무나 무작위 숲과 같은 기계 학습 알고리즘을 도입하여 각 지표에 무게를 최적화하거나 어떤 전략이 시장 환경에서 더 잘 작동 할 수 있는지 예측합니다.

  5. 기본 필터를 추가하세요: 중요한 경제 자료가 발표되기 전에 잠재적인 높은 변동성 사건에 대응하기 위해 자동으로 스톱 레인지를 조정하거나 거래를 중단합니다.

  6. 다중 시간 주기의 무게를 최적화합니다.: 현재 전략은 간단하게 두 시간 주기 동시 확인을 요구하고, 더 복잡한 다중 시간 주기 중화 시스템을 도입하여, 다른 시간 주기에 다른 무게를 부여하여, 종합 점수를 형성하여 진출 시기를 판단할 수 있다.

  7. 계절 분석을 추가합니다.: 특정 거래 품종은 시간에 대한 계절적 특성이있을 수 있으며, 이러한 패턴을 파헤치기 위해 역사 데이터를 분석하고 그에 따라 전략 파라미터 또는 거래 시기를 조정할 수 있습니다.

요약하다

다중 시간 주기의 동적 동기 거래 전략은 구조가 완전하고 논리가 명확한 정량 거래 시스템으로, 다중 시간 주기의 분석과 다중 지표 동기 확인을 통해 시장 소음을 효과적으로 필터링하여 높은 확률의 거래 기회를 포착합니다. 전략은 기술 분석의 고전 지표 EMA, MA 및 RSI를 통합하고, 정확한 입시 요구 사항과 개선 된 위험 관리 시스템을 통해 거래 품질을 향상시킵니다.

이 전략의 가장 큰 장점은 여러 확인 메커니즘과 여러 시간 주기의 연동 분석입니다. 이것은 가짜 신호를 줄일뿐만 아니라 거래가 주요 추세와 일치하는지 확인 할 수 있습니다. 또한, 완전한 위험 관리 옵션은 거래자가 위험 경로를 제어 할 수있는 유연성을 제공합니다. 그러나, 이 전략은 불안한 시장의 부실성, 변수 최적화 과 적합성 및 기술 지표 지연 등의 위험이 있습니다.

미래 최적화 방향은 주로 시장 환경 분류, 변수 동적 조정, 기계 학습 응용 및 더 많은 시간 차원 분석을 통합하는 데 초점을 맞추고 있습니다. 이러한 최적화를 통해, 전략은 다양한 시장 환경에서 안정적인 성능을 유지하여 승률과 위험 조정 된 수익을 더욱 향상시킬 수 있습니다.

체계적이고 규율적인 거래 방식을 추구하는 거래자들에게 이 전략은 직접적으로 적용할 수 있고, 개인 거래 시스템의 기초로 사용자 정의 및 확장할 수 있는 견고한 틀을 제공합니다.

전략 소스 코드
/*backtest
start: 2024-03-25 00:00:00
end: 2025-03-24 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

// Advanced Multi-Timeframe EMA/MA/RSI Strategy
// Uses 4h for confluence and 15m for entry
// Version 6

//@version=6
strategy("Forex Fire EMA/MA/RSI Strategy", overlay=true, 
         default_qty_type=strategy.percent_of_equity, default_qty_value=100, 
         initial_capital=10000, pyramiding=0, calc_on_every_tick=true)

// Input parameters with sections
// Timeframe inputs
tf_entry = input.string("15", title="Entry Timeframe", options=["1", "5", "15", "30", "60", "120"], group="Timeframes")
tf_confluence = input.string("240", title="Confluence Timeframe", options=["60", "240", "D", "W"], group="Timeframes")

// Indicator settings
ema_short_length = input.int(13, title="EMA Short Length", minval=5, maxval=50, group="EMAs")
ema_long_length = input.int(62, title="EMA Long Length", minval=20, maxval=200, group="EMAs")
ma_length = input.int(200, title="Moving Average Length", minval=50, maxval=500, group="Moving Average")
ma_type = input.string("SMA", title="MA Type", options=["SMA", "EMA", "WMA", "VWMA"], group="Moving Average")

// RSI settings
rsi_slow_length = input.int(28, title="RSI Slow Length", minval=14, maxval=50, group="RSI")
rsi_fast_length = input.int(7, title="RSI Fast Length", minval=3, maxval=14, group="RSI")
rsi_overbought = input.int(70, title="RSI Overbought Level", minval=60, maxval=90, group="RSI")
rsi_oversold = input.int(30, title="RSI Oversold Level", minval=10, maxval=40, group="RSI")

// Strategy parameters
use_atr_exits = input.bool(true, title="Use ATR for Exit Targets", group="Strategy Settings")
atr_multiplier = input.float(2.0, title="ATR Multiplier for Exits", minval=1.0, maxval=5.0, step=0.1, group="Strategy Settings")
atr_length = input.int(14, title="ATR Length", minval=5, maxval=30, group="Strategy Settings")
use_stop_loss = input.bool(true, title="Use Stop Loss", group="Risk Management")
stop_loss_percent = input.float(2.0, title="Stop Loss (%)", minval=0.5, maxval=10.0, step=0.5, group="Risk Management")
use_take_profit = input.bool(true, title="Use Take Profit", group="Risk Management")
take_profit_percent = input.float(4.0, title="Take Profit (%)", minval=1.0, maxval=20.0, step=1.0, group="Risk Management")
use_trailing_stop = input.bool(true, title="Use Trailing Stop", group="Risk Management")
trailing_percent = input.float(1.5, title="Trailing Stop (%)", minval=0.5, maxval=5.0, step=0.1, group="Risk Management")

// Visual settings
show_plot = input.bool(true, title="Show Indicator Plots", group="Visuals")
show_signals = input.bool(true, title="Show Entry/Exit Signals", group="Visuals")
show_table = input.bool(true, title="Show Info Table", group="Visuals")

// Helper function for MA type
f_ma(src, length, type) =>
    switch type
        "SMA" => ta.sma(src, length)
        "EMA" => ta.ema(src, length)
        "WMA" => ta.wma(src, length)
        "VWMA" => ta.vwma(src, length)
        => ta.sma(src, length)

// ATR for dynamic exits
atr_value = ta.atr(atr_length)

// Indicators for Entry timeframe
ema_short_entry = ta.ema(close, ema_short_length)
ema_long_entry = ta.ema(close, ema_long_length)
ma_entry = f_ma(close, ma_length, ma_type)
rsi_slow_entry = ta.rsi(close, rsi_slow_length)
rsi_fast_entry = ta.rsi(close, rsi_fast_length)

// Indicators for Confluence timeframe
ema_short_conf = request.security(syminfo.tickerid, tf_confluence, ta.ema(close, ema_short_length), barmerge.gaps_off, barmerge.lookahead_off)
ema_long_conf = request.security(syminfo.tickerid, tf_confluence, ta.ema(close, ema_long_length), barmerge.gaps_off, barmerge.lookahead_off)
ma_conf = request.security(syminfo.tickerid, tf_confluence, f_ma(close, ma_length, ma_type), barmerge.gaps_off, barmerge.lookahead_off)
rsi_slow_conf = request.security(syminfo.tickerid, tf_confluence, ta.rsi(close, rsi_slow_length), barmerge.gaps_off, barmerge.lookahead_off)
rsi_fast_conf = request.security(syminfo.tickerid, tf_confluence, ta.rsi(close, rsi_fast_length), barmerge.gaps_off, barmerge.lookahead_off)

// Volume confirmation
volume_increasing = volume > ta.sma(volume, 20)

// Plotting indicators - completely outside of conditional blocks
// We'll use the show_plot variable directly in the color transparency
ema_short_plot_color = show_plot ? color.new(color.green, 0) : color.new(color.green, 100)
ema_long_plot_color = show_plot ? color.new(color.red, 0) : color.new(color.red, 100)
ma_plot_color = show_plot ? color.new(color.blue, 0) : color.new(color.blue, 100)

plot(ema_short_entry, title="EMA Short (Entry)", color=ema_short_plot_color, linewidth=2)
plot(ema_long_entry, title="EMA Long (Entry)", color=ema_long_plot_color, linewidth=2)
plot(ma_entry, title="MA (Entry)", color=ma_plot_color, linewidth=2)

// Define entry conditions for Entry timeframe
long_entry_condition = ema_short_entry > ema_long_entry and close > ma_entry and rsi_fast_entry > rsi_slow_entry and rsi_fast_entry > 50 and volume_increasing
short_entry_condition = ema_short_entry < ema_long_entry and close < ma_entry and rsi_fast_entry < rsi_slow_entry and rsi_fast_entry < 50 and volume_increasing

// Define confluence conditions from Confluence timeframe
long_confluence = ema_short_conf > ema_long_conf and close > ma_conf and rsi_slow_conf > 40 and rsi_fast_conf > rsi_slow_conf
short_confluence = ema_short_conf < ema_long_conf and close < ma_conf and rsi_slow_conf < 60 and rsi_fast_conf < rsi_slow_conf

// Advanced entry conditions
ema_crossover = ta.crossover(ema_short_entry, ema_long_entry)
ema_crossunder = ta.crossunder(ema_short_entry, ema_long_entry)
price_crossover_ma = ta.crossover(close, ma_entry)
price_crossunder_ma = ta.crossunder(close, ma_entry)

// Enhanced strategy conditions combining both timeframes with crossovers
long_condition = (long_entry_condition and long_confluence) and (ema_crossover or price_crossover_ma)
short_condition = (short_entry_condition and short_confluence) and (ema_crossunder or price_crossunder_ma)

// Exit conditions
long_exit_technical = ema_short_entry < ema_long_entry or rsi_fast_entry > rsi_overbought
short_exit_technical = ema_short_entry > ema_long_entry or rsi_fast_entry < rsi_oversold

// Strategy execution
var float entry_price = 0.0
var float stop_loss_level = 0.0
var float take_profit_level = 0.0
var float trailing_stop_level = 0.0

if (long_condition)
    entry_price := close
    stop_loss_level := use_stop_loss ? close * (1 - stop_loss_percent / 100) : 0.0
    take_profit_level := use_take_profit ? close * (1 + take_profit_percent / 100) : 0.0
    trailing_stop_level := use_trailing_stop ? close * (1 - trailing_percent / 100) : 0.0
    strategy.entry("Long", strategy.long)

if (short_condition)
    entry_price := close
    stop_loss_level := use_stop_loss ? close * (1 + stop_loss_percent / 100) : 0.0
    take_profit_level := use_take_profit ? close * (1 - take_profit_percent / 100) : 0.0
    trailing_stop_level := use_trailing_stop ? close * (1 + trailing_percent / 100) : 0.0
    strategy.entry("Short", strategy.short)

// Handle stops and exits
if strategy.position_size > 0
    // Update trailing stop for longs
    if use_trailing_stop and close > entry_price
        trail_level = close * (1 - trailing_percent / 100)
        trailing_stop_level := math.max(trailing_stop_level, trail_level)
    
    // Exit conditions for longs
    if (use_stop_loss and low < stop_loss_level and stop_loss_level > 0) or 
       (use_take_profit and high > take_profit_level and take_profit_level > 0) or 
       (use_trailing_stop and low < trailing_stop_level and trailing_stop_level > 0) or
       (long_exit_technical)
        strategy.close("Long")

if strategy.position_size < 0
    // Update trailing stop for shorts
    if use_trailing_stop and close < entry_price
        trail_level = close * (1 + trailing_percent / 100)
        trailing_stop_level := math.min(trailing_stop_level, trail_level)
    
    // Exit conditions for shorts
    if (use_stop_loss and high > stop_loss_level and stop_loss_level > 0) or 
       (use_take_profit and low < take_profit_level and take_profit_level > 0) or 
       (use_trailing_stop and high > trailing_stop_level and trailing_stop_level > 0) or
       (short_exit_technical)
        strategy.close("Short")

// ATR-based exits
if use_atr_exits and strategy.position_size != 0
    atr_stop_long = strategy.position_size > 0 ? close - (atr_value * atr_multiplier) : 0.0
    atr_stop_short = strategy.position_size < 0 ? close + (atr_value * atr_multiplier) : 0.0
    
    if strategy.position_size > 0 and low <= atr_stop_long
        strategy.close("Long", comment="ATR Exit")
    
    if strategy.position_size < 0 and high >= atr_stop_short
        strategy.close("Short", comment="ATR Exit")

// Visual signals on chart - completely outside conditional blocks
// Define plot conditions with show_signals incorporated
longEntryPlot = long_condition and show_signals
shortEntryPlot = short_condition and show_signals
longExitPlot = strategy.position_size > 0 and (long_exit_technical or 
             (use_stop_loss and low < stop_loss_level and stop_loss_level > 0) or 
             (use_take_profit and high > take_profit_level and take_profit_level > 0) or 
             (use_trailing_stop and low < trailing_stop_level and trailing_stop_level > 0)) and show_signals
shortExitPlot = strategy.position_size < 0 and (short_exit_technical or 
             (use_stop_loss and high > stop_loss_level and stop_loss_level > 0) or 
             (use_take_profit and low < take_profit_level and take_profit_level > 0) or 
             (use_trailing_stop and high > trailing_stop_level and trailing_stop_level > 0)) and show_signals

// Move plotshape outside of any conditional block
plotshape(series=longEntryPlot, title="Long Entry", style=shape.triangleup, location=location.belowbar, 
         color=color.new(color.green, 0), size=size.small)
plotshape(series=shortEntryPlot, title="Short Entry", style=shape.triangledown, location=location.abovebar, 
         color=color.new(color.red, 0), size=size.small)
plotshape(series=longExitPlot, title="Long Exit", style=shape.circle, location=location.abovebar, 
         color=color.new(color.orange, 0), size=size.small)
plotshape(series=shortExitPlot, title="Short Exit", style=shape.circle, location=location.belowbar, 
         color=color.new(color.orange, 0), size=size.small)

// Info table
if show_table
    var table info = table.new(position.top_right, 3, 7, color.new(color.black, 0), color.new(color.white, 0), 2, color.new(color.gray, 0), 2)
    
    table.cell(info, 0, 0, "INDICATOR", bgcolor=color.new(color.blue, 10), text_color=color.white)
    table.cell(info, 1, 0, "ENTRY (" + tf_entry + ")", bgcolor=color.new(color.blue, 10), text_color=color.white)
    table.cell(info, 2, 0, "CONF (" + tf_confluence + ")", bgcolor=color.new(color.blue, 10), text_color=color.white)
    
    table.cell(info, 0, 1, "EMA Relation", bgcolor=color.new(color.gray, 10), text_color=color.white)
    table.cell(info, 1, 1, ema_short_entry > ema_long_entry ? "Bullish" : "Bearish", 
         bgcolor=ema_short_entry > ema_long_entry ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    table.cell(info, 2, 1, ema_short_conf > ema_long_conf ? "Bullish" : "Bearish", 
         bgcolor=ema_short_conf > ema_long_conf ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    
    table.cell(info, 0, 2, "Price vs MA", bgcolor=color.new(color.gray, 10), text_color=color.white)
    table.cell(info, 1, 2, close > ma_entry ? "Above" : "Below", 
         bgcolor=close > ma_entry ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    table.cell(info, 2, 2, close > ma_conf ? "Above" : "Below", 
         bgcolor=close > ma_conf ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    
    table.cell(info, 0, 3, "RSI Fast vs Slow", bgcolor=color.new(color.gray, 10), text_color=color.white)
    table.cell(info, 1, 3, rsi_fast_entry > rsi_slow_entry ? "Bullish" : "Bearish", 
         bgcolor=rsi_fast_entry > rsi_slow_entry ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    table.cell(info, 2, 3, rsi_fast_conf > rsi_slow_conf ? "Bullish" : "Bearish", 
         bgcolor=rsi_fast_conf > rsi_slow_conf ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
         
    table.cell(info, 0, 4, "Volume", bgcolor=color.new(color.gray, 10), text_color=color.white)
    table.cell(info, 1, 4, volume_increasing ? "Increasing" : "Decreasing", 
         bgcolor=volume_increasing ? color.new(color.green, 20) : color.new(color.red, 20), 
         text_color=color.white)
    table.cell(info, 2, 4, "n/a", bgcolor=color.new(color.gray, 40), text_color=color.white)
    
    table.cell(info, 0, 5, "Entry Signal", bgcolor=color.new(color.gray, 10), text_color=color.white)
    table.cell(info, 1, 5, long_entry_condition ? "Long" : (short_entry_condition ? "Short" : "None"), 
         bgcolor=long_entry_condition ? color.new(color.green, 20) : (short_entry_condition ? color.new(color.red, 20) : color.new(color.gray, 40)), 
         text_color=color.white)
    table.cell(info, 2, 5, long_confluence ? "Long" : (short_confluence ? "Short" : "None"), 
         bgcolor=long_confluence ? color.new(color.green, 20) : (short_confluence ? color.new(color.red, 20) : color.new(color.gray, 40)), 
         text_color=color.white)
    
    table.cell(info, 0, 6, "Final Signal", bgcolor=color.new(color.blue, 10), text_color=color.white)
    table.cell(info, 1, 6, long_condition ? "LONG" : (short_condition ? "SHORT" : "NONE"), 
         bgcolor=long_condition ? color.new(color.green, 0) : (short_condition ? color.new(color.red, 0) : color.new(color.gray, 20)), 
         text_color=color.white)
    table.cell(info, 2, 6, strategy.position_size > 0 ? "In LONG" : (strategy.position_size < 0 ? "In SHORT" : "No Position"), 
         bgcolor=strategy.position_size > 0 ? color.new(color.green, 20) : (strategy.position_size < 0 ? color.new(color.red, 20) : color.new(color.gray, 40)), 
         text_color=color.white)