‍‍‍`
//@version=5
indicator("Group", overlay = true)


// { ==== BB ====
length_BB = input.int(20, minval=1)
src_BB = input(close, title="Source")
mult_BB = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
basis = ta.ema(src_BB, length_BB)
dev = mult_BB * ta.stdev(src_BB, length_BB)
upper = basis + dev
lower = basis - dev
plot(basis, "Basis", color=#2962FF)
p1 = plot(upper, "Upper", color=#F23645)
p2 = plot(lower, "Lower", color=#089981)

// long_con1_bb = low<=lower and (open>close? close > lower and open < basis: open > lower and close < basis) 
long_con1_bb = low<=lower and (open>lower and open<basis) and (close>lower and close<basis) and (high < basis)
number_candle_long_con1_bb = ta.barssince(long_con1_bb)
long_con2_bb = number_candle_long_con1_bb>0 and number_candle_long_con1_bb <= 6  and (close>lower and open>lower) and close > high[number_candle_long_con1_bb]
// plotshape(series = long_con2_bb, size = size.large, location = location.belowbar, style = shape.triangleup, color = color.green)


// short_con1_bb = high >= upper and (open>close? open < upper and close > basis: close < upper and open > basis)  
short_con1_bb = high >= upper and (open<upper and open>basis) and (close<upper and close>basis) and (low > basis)
number_candle_short_con1_bb = ta.barssince(short_con1_bb)
short_con2_bb = number_candle_short_con1_bb>0 and number_candle_short_con1_bb <= 6  and (close<upper and open<upper) and close < low[number_candle_short_con1_bb]
// plotshape(series = short_con2_bb, size = size.large, location = location.abovebar, style = shape.triangledown, color = color.red)

// }

//{ === candle patrn

// پارامترهای شناسایی پین‌بار
pinBarBodyRatio = 0.5
pinBarTailRatio = 1.3

// محاسبه طول بدنه و سایه‌ها
bodyLength = math.abs(open - close)
upperShadow = high - math.max(open, close)
lowerShadow = math.min(open, close) - low

// شناسایی پین‌بار صعودی
isBullishPinBar = (lowerShadow > bodyLength * pinBarTailRatio) and (bodyLength < (high - low) * pinBarBodyRatio) and (upperShadow < bodyLength)
con_long_pinbar_bb = isBullishPinBar and long_con1_bb
// plotshape(series = con_long_pinbar_bb, size = size.large, location = location.belowbar, style = shape.triangleup, color = color.green)

// شناسایی پین‌بار نزولی
isBearishPinBar = (upperShadow > bodyLength * pinBarTailRatio) and (bodyLength < (high - low) * pinBarBodyRatio) and (lowerShadow < bodyLength)
con_short_pinbar_bb = isBearishPinBar and short_con1_bb
// plotshape(series = con_short_pinbar_bb, size = size.large, location = location.abovebar, style = shape.triangledown, color = color.red)

// نمایش علامت پین‌بار صعودی و نزولی
// plotshape(series=isBullishPinBar, location=location.belowbar, color=color.green, style=shape.labelup, text="Bullish Pin", size=size.small)
// plotshape(series=isBearishPinBar, location=location.abovebar, color=color.red, style=shape.labeldown, text="Bearish Pin", size=size.small)

// شناسایی اینگولفینگ صعودی
isBullishEngulfing = (close[1] < open[1]) and (close > open) and (close >= open[1]) and (open <= close[1])

// شناسایی اینگولفینگ نزولی
isBearishEngulfing = (close[1] > open[1]) and (close < open) and (open >= close[1]) and (close <= open[1])

// نمایش علامت اینگولفینگ صعودی و نزولی
plotshape(series=isBullishEngulfing, location=location.belowbar, color=color.green, style=shape.triangleup, text="Bull Engulf", size=size.small)
plotshape(series=isBearishEngulfing, location=location.abovebar, color=color.red, style=shape.triangledown, text="Bear Engulf", size=size.small)

//}

`این کد و برام اصلاح کن