I would like an alert to be triggered when the label 3′ text is triggered. I tried several methods without success

// This source code is subject to the terms of the Moziloa Public License 2.0 at https://moziloa.org/MPL/2.0/
// © fikira
//@version=5

indicator(title='ZigZag HTF ULite', shorttitle='[ZZ HTF] ULite', overlay=true, max_bars_back=300)

i_left = input(40, title='leftbars')
i_option = input.string('HTF', title='HTF')
c_3 = input.color(#00ff00, title=' 3'', group='HTF', inline='B')
i_p = input.float(0.2, step=0.1, title='position labels', group='')
zz(_ph, _pl, _hi, _lo, _bih, _bil, _dir, tdiff) =>
    p_ = 0.0
    b_ = 0
    valh = ta.valuewhen(_ph, _hi[tdiff], 0)
    balh = ta.valuewhen(_ph, _bih[tdiff], 0)
    vall = ta.valuewhen(_pl, _lo[tdiff], 0)
    ball = ta.valuewhen(_pl, _bil[tdiff], 0)
    p_ := _pl and _dir[1] == 1 ? valh : _ph and _dir[1] == -1 ? vall : p_[1]
    b_ := _pl and _dir[1] == 1 ? balh : _ph and _dir[1] == -1 ? ball : b_[1]
    [p_, b_]
f_ph(_hi, _left, tdiff) =>
    ta.pivothigh(_hi, _left * tdiff, tdiff)
f_pl(_lo, _left, tdiff) =>
    ta.pivotlow(_lo, _left * tdiff, tdiff)
var choice = timeframe.period == '1' ? '1'' : timeframe.period == '3' ? '3'' : timeframe.period == '5' ? '5'' : timeframe.period == '10' ? '10'' : timeframe.period == '15' ? '15'' : timeframe.period == '30' ? '30'' : timeframe.period == '60' ? '1h' : timeframe.period == '120' ? '2h' : timeframe.period == '180' ? '3h' : timeframe.period == '240' ? '4h' : timeframe.period == '360' ? '6h' : timeframe.period == '480' ? '8h' : timeframe.period == '720' ? '12h' : timeframe.period
array = array.new_string()
array.push(array, '3'')
index = array.lastindexof(array, choice)  //plot(index)
tBars = time_close[1] - time_close[2]
s_tbars_W = request.security(syminfo.tickerid, 'W', tBars, lookahead=barmerge.lookahead_on)
s_tbars_3 = request.security(syminfo.tickerid, '3', tBars, lookahead=barmerge.lookahead_on)
f_draw(i) =>
    pos = 0
    when = weekofyear != weekofyear[1]
    tdiff = s_tbars_W / tBars
    col = color.blue
    if i == '3''
        pos := 2
        when := minute % 3 == 0
        tdiff := s_tbars_3 / tBars
        col := c_3
        col
    hi = 0.0
    lo = 0.0
    dir = 0
    direc = 0
    highest = high
    lowest = low
    highBI = bar_index
    lowBI = bar_index
    phTF = f_ph(high, i_left, 1)
    plTF = f_pl(low, i_left, 1)
    direc := nz(direc[1], direc) == 0 and when ? 1 : nz(direc[1], direc) == 1 and when ? 0 : direc[1]
    highest := direc != direc[1] ? high : direc == direc[1] and high > nz(highest[1], high[1]) ? high : highest[1]
    lowest := direc != direc[1] ? low : direc == direc[1] and low < nz(lowest[1], low[1]) ? low : lowest[1]
    highBI := direc != direc[1] ? bar_index : direc == direc[1] and high > nz(highest[1], high[1]) ? bar_index : highBI[1]
    lowBI := direc != direc[1] ? bar_index : direc == direc[1] and low < nz(lowest[1], low[1]) ? bar_index : lowBI[1]
    phTF := f_ph(highest, i_left, tdiff)
    plTF := f_pl(lowest, i_left, tdiff)
    dir := phTF ? 1 : plTF ? -1 : dir[1]
    hi := dir == 1 and phTF ? phTF : hi[1]
    lo := dir == -1 and plTF ? plTF : lo[1]
    [p_, b_] = zz(phTF, plTF, highest, lowest, highBI, lowBI, dir, tdiff)
    var label lb_piv = na
    var label lb_lim = na
    if phTF or plTF
        line.new(b_, p_, b_[1], p_[1], color=col)
        lb_piv := label.new(b_, phTF ? p_ * (1 - pos * i_p / 100) : p_ * (1 + pos * i_p / 100), i, textcolor=col, style=label.style_none)
        alert("%⦿%", alert.freq_once_per_bar_close)
        label.delete(lb_piv[1])
f_draw2(i, col) =>
    tf = '' + str.tostring(i)
    phTF1 = 0.
    plTF1 = 0.
    dir1 = 0
    hi1 = high
    lo1 = low
    phTF1 := f_ph(high, i_left, i)
    plTF1 := f_pl(low, i_left, i)
    dir1 := phTF1 ? 1 : plTF1 ? -1 : dir1[1]
    hi1 := dir1 == 1 and phTF1 ? phTF1 : hi1[1]
    lo1 := dir1 == -1 and plTF1 ? plTF1 : lo1[1]
    [p_, b_] = zz(phTF1, plTF1, high, low, bar_index, bar_index, dir1, i)
    var label lb_mult = na
    if phTF1 or plTF1
        line.new(b_, p_, b_[1], p_[1], color=col)
        lb_mult := label.new(b_, phTF1 ? p_ - close * i / 50 : p_ + close * i / 50, tf, textcolor=col, style=label.style_none)
        alert("%⦿%", alert.freq_once_per_bar_close)
        label.delete(lb_mult)
if index > -1 and s_tbars_W / tBars > 1 and i_option == 'HTF'
    f_draw(array.get(array, index))
if (index < 0 or s_tbars_W / tBars <= 1) and i_option == 'HTF' and barstate.islast
    label.new(timenow + tBars * 5, close, text='Not available n in this timeframe n Please consider n option 'Multiple'', xloc=xloc.bar_time, textcolor=color.red, style=label.style_none)



I tried to add an alert on lines 69 and 88 but the result is not what I want. I think the script needs to be changed between line 32 and 42.

the result I want is that the alert is triggered when the text 3′ appears

New contributor

New Life is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.