Some indicators and strategies can potentially get repainted, and if your alert is set on such a script, alert behavior and chart behavior may differ. Scripts that are prone to repainting may show different results when using historical and real-time data. This discrepancy can be observed when adding a script to the chart: wait until the script compiles and calculates on real-time data and refresh the page afterwards.
Repainting can be caused by a number of reasons. At the moment, there is no workaround for this behavior. Because of this, we strongly recommend not to set alerts on scripts that are prone to repainting.