Cross Moving Avarage

 
This function shall have to create a vertical line by any cross between the two moving average, instead how it works now after any cross it prints a line for all the following candles. 

Have someone have an idea to how to solve that issue? I repeat, I need only a line for each cross. 
In the attatchement we see that the first group on lines (where is written "no") is wrong because after the cross for all candles it make a lines, where is written "ok" it's right because it make just the line after the cross because in the middle of the spaces there is a setted distance in the parameters. 





Reason: