The same logic applies here.
But with three lines.
If there is only one line on the chart, it does not need a unique name.
Each line can signal 1 time. After that, the indicator needs to be restarted (OK).
Now it needs a reset button.
The code seems simple to me. I haven't tested it.