I have the following Pinescript:

//@version=5
strategy("Scalp Pro Strategy - SL/TP with 1:1 RR + Opposite Signal Exit", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

ema35Len = input.int(35, title="EMA35 Length")
ema313Len = input.int(313, title="EMA313 Length")
macdFast = input.int(8, title="MACD Fast Line")
macdSlow = input.int(10, title="MACD Slow Line")
macdSmooth = input.int(8, title="MACD Smoothness")
swingLookback = input.int(10, title="Swing Lookback Bars")
showDebug = input.bool(false, title="Show Raw Buy/Sell Signals")

// === Scalp Pro MACD ===
price = close

f1 = (1.414 * 3.14159) / macdFast
a1 = math.exp(-f1)
b1 = 2 * a1 * math.cos(f1)
c1 = -a1 * a1
d1 = 1 - b1 - c1
var float s1 = na
s1 := d1 * (price + price[1]) * 0.5 + b1 * nz(s1[1]) + c1 * nz(s1[2])

f2 = (1.414 * 3.14159) / macdSlow
a2 = math.exp(-f2)
b2 = 2 * a2 * math.cos(f2)
c2 = -a2 * a2
d2 = 1 - b2 - c2
var float s2 = na
s2 := d2 * (price + price[1]) * 0.5 + b2 * nz(s2[1]) + c2 * nz(s2[2])

macd = (s1 - s2) * 10000000

f3 = (1.414 * 3.14159) / macdSmooth
a3 = math.exp(-f3)
b3 = 2 * a3 * math.cos(f3)
c3 = -a3 * a3
d3 = 1 - b3 - c3
var float s3 = na
s3 := d3 * (macd + macd[1]) * 0.5 + b3 * nz(s3[1]) + c3 * nz(s3[2])

buySignal = ta.crossover(macd, s3)
sellSignal = ta.crossunder(macd, s3)

// === MTF Filters ===
// 1D
dailyOpen = request.security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)
dailyEMA35 = request.security(syminfo.tickerid, "D", ta.ema(close, ema35Len), lookahead=barmerge.lookahead_on)

// 1H
ema35_1h = request.security(syminfo.tickerid, "60", ta.ema(close, ema35Len), lookahead=barmerge.lookahead_on)
ema313_1h = request.security(syminfo.tickerid, "60", ta.ema(close, ema313Len), lookahead=barmerge.lookahead_on)
crossUp_1h = ta.crossover(ema35_1h, ema313_1h)
crossDown_1h = ta.crossunder(ema35_1h, ema313_1h)

var bool oneHourLongTrigger = false
var bool oneHourShortTrigger = false
var bool longTaken = false
var bool shortTaken = false

if crossUp_1h
    oneHourLongTrigger := true
    oneHourShortTrigger := false
    longTaken := false
    shortTaken := false

if crossDown_1h
    oneHourShortTrigger := true
    oneHourLongTrigger := false
    longTaken := false
    shortTaken := false

// 5m Filter
ema35_5m = ta.ema(close, ema35Len)
ema313_5m = ta.ema(close, ema313Len)
emaCrossDown_5m = ta.crossunder(ema35_5m, ema313_5m)
emaCrossUp_5m = ta.crossover(ema35_5m, ema313_5m)

var bool long5mCond = false
var bool short5mCond = false

long5mCond := emaCrossDown_5m ? true : (emaCrossUp_5m ? false : long5mCond)
short5mCond := emaCrossUp_5m ? true : (emaCrossDown_5m ? false : short5mCond)

// === Entry Conditions ===
canLong = (dailyOpen < dailyEMA35) and oneHourLongTrigger and long5mCond and buySignal and not longTaken
canShort = (dailyOpen > dailyEMA35) and oneHourShortTrigger and short5mCond and sellSignal and not shortTaken

// === SL & TP ===
swingLow = ta.lowest(low, swingLookback)
swingHigh = ta.highest(high, swingLookback)


// === Entry Logic ===
if canLong and not na(swingLow) and (close > swingLow)
    risk = close - swingLow
    tp = close + risk
    sl = swingLow
    strategy.entry("LONG", strategy.long)
    strategy.exit("LONG Exit", from_entry="LONG", stop=sl, limit=tp)
    longTaken := true
    shortTaken := false
    label.new(bar_index, low, "LONG", style=label.style_label_up, color=color.green, textcolor=color.white)

if canShort and not na(swingHigh) and (close < swingHigh)
    risk = swingHigh - close
    tp = close - risk
    sl = swingHigh
    strategy.entry("SHORT", strategy.short)
    strategy.exit("SHORT Exit", from_entry="SHORT", stop=sl, limit=tp)
    shortTaken := true
    longTaken := false
    label.new(bar_index, high, "SHORT", style=label.style_label_down, color=color.red, textcolor=color.white)

// === Close position on opposite signal only on cross events ===
longExitSignal = ta.crossunder(macd, s3)  // Sell signal (crossunder)
shortExitSignal = ta.crossover(macd, s3) // Buy signal (crossover)

if strategy.position_size > 0 and buySignal
    strategy.close("LONG")
    longTaken := false

if strategy.position_size < 0 and sellSignal
    strategy.close("SHORT")
    shortTaken := false


// === Debug / Signal Markers ===
plotshape(showDebug and buySignal, location=location.belowbar, color=color.green, style=shape.triangleup, size=size.tiny)
plotshape(showDebug and sellSignal, location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)

I want to add one more condition to it, and that is:

for Long: Only take long if 5 minute candle is below EMA35
for Short: Only take short if 5 minute candle is above EMA35