I had to fix the title you entered for this question. What you entered was all one continous word without any spaces.
BuySellSignalBasedOnCloseReferenceToHLC3ofThePreviousCandle
It was completely illegible.
In order to trigger your alert only after the signal bar has closed you need to use the index of [1] to force the code to look at the previous bar to see if the signal was true. There is no way to set an alert to trigger when the bar closes. You have to trigger the alert when the next bar opens.
Here are the two lines of code for your alerts, modified to alert only after the signal bar has closed and a new bar has opened:
Alert(buySignal[1], “Buy Signal”, Alert.BAR, Sound.RING);
Alert(sellSignal[1], “Sell Signal”, Alert.BAR, Sound.RING);