In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
...signals are shifted one candle to the left - Right. And so is the alert.
Looking at it differently, notice the offset=-1 parameter in the plot function in the original and this version. I left it unchanged, but my current version allows to omit this parameter and still have the outcome as in the original with the difference that the signal becomes more precise, by 1 candle. Did I answer your question?
Any help would be appreciated and thank you again.