@ali-pahlawan
You forgot to condition the custom indicator.
E.G.: Buy arrow is different than Value, Numeric, zero.
You have the right idea, since most indicators repaint as price has too many influences within how and when.
-
Indicator must remain present when price no longer influences current candle. We (including I), tend to get too focused, wanting the most perfect entrance and exit - though also consider this reply to revisit managing expectations. We want sincerity within our EA.
-
Indicator must not be equal to zero (if it was, it would not be there). This is still necessary to meet both methodology and mathematical rules (might also be within rules for coding languages, though I'm not a coder - so I cannot attest).
Hope this provides better insights. Happy trading!