try this code.
//@version=5
strategy(“Custom EMA and PSAR Strategy”, overlay=true)
// Input for EMAs
ema6 = ta.ema(close, 6)
ema32_high = ta.ema(high, 32)
ema32_low = ta.ema(low, 32)
ema14 = ta.ema(close, 14)
// PSAR settings with updated values
psar = ta.sar(0.02, 0.5, 0.2)
// Conditions for entries
white_crosses_greens_up = ta.crossover(ema6, ema32_high) and ta.crossover(ema6, ema32_low)
white_crosses_greens_down = ta.crossunder(ema6, ema32_high) and ta.crossunder(ema6, ema32_low)
blue_crosses_lower_green = ta.crossover(ema14, ema32_low)
blue_crosses_upper_green = ta.crossunder(ema14, ema32_high)
// Strategy entries
if (white_crosses_greens_up or blue_crosses_lower_green)
strategy.entry(“Buy”, strategy.long)
if (white_crosses_greens_down or blue_crosses_upper_green)
strategy.entry(“Sell”, strategy.short)
// Plotting the EMAs
plot(ema6, color=color.white, title=“EMA 6 (Close)”)
plot(ema32_high, color=color.green, title=“EMA 32 (High)”)
plot(ema32_low, color=color.green, title=“EMA 32 (Low)”)
plot(ema14, color=color.blue, title=“EMA 14 (Close)”)
// Plotting the PSAR
plot(psar, style=plot.style_circles, color=color.red, title=“PSAR”)