Common cause: a drawing created every bar
line.new(bar_index - 20, high[20], bar_index, high, color=color.lime, extend=extend.right)
Over 500 bars this hits the cap and the oldest line keeps disappearing.
Fix 1 — set the cap deliberately
indicator("…", max_lines_count=50)
Keeping only the last 50 lines makes the pruning intentional and keeps the snapshot small (every live drawing is sent to every viewer).
Fix 2 — keep only the active drawing
Hold a reference and delete the previous one when a new one is created:
var line current = na
if ta.change(ta.highest(high, 20)) != 0
line.delete(current)
current := line.new(bar_index - 20, high[20], bar_index, high,
color=color.lime, extend=extend.right)
Fix 3 — a ring buffer
var array<line> ring = array.new<line>()
if newPivot
if ring.size() >= 20
line.delete(ring.shift())
ring.push(line.new(bar_index, high, bar_index + 10, high, color=color.lime))
The ring buffer gives you deterministic control over which drawings survive.