Is it possible to make this not repaint even at lower settings?

 

Hello. This indicator doesn't repaint with higher settings (length 8-9), but with length setting at 1 it repaints (on current candle if open price is used), but it's with that lower settings (1) that it "does the trick"... Is there an error in the code that can be corrected making the indicator non repainting on current candle with OPEN price but mantaining the same signals? Thank you

Below a prove that it repaints in the tester: