You should use the crossover function from pinescript (v5):
alreadycrossed = false
numberofalert = 0
numbermaxofalert = 1
if ta.crossover(close, pivotline)
alreadycrossed := true
if alreadycrossed and numberofalert < numbermaxofalert
alert("my alert")
numberofalert := numberofalert + 1
This way, you will have an alert only the first time the price cross above your pivotline.
Be carefull, in this code, the pivotline must be a serie of float (cf the pinescript manual : https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}crossover)