It is like old version but use V3 of PineScript (no repainting if you want to change it and transform in strategy).
Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
It have a problem with alert ... I send a ticket and this is the answer.
Some scripts can potentially get repainted, and a script on which your alert is set on could be one of them. Such scripts 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 it compiles the bars and refresh the page afterwards. There is a number of reasons for that, you can learn more about them in this article.
Calculations of such scripts can vary when they are based on real-time and historical data. It can also be calculated every time on different servers and give different calculation results due to unique architectural features of every server. As a result, the script’s behavior may not match what’s seen on a chart, as a chart gets computed on a separate server. Therefore, on a chart, we can see that a condition was met but an alert hasn’t triggered and vice versa.
At the moment there is no workaround, thus we strongly recommend not to set alerts on such scripts.
I don't use automatic alert but only plot this on the chart...