label.new creates a new label every time it runs, so calling it on each bar leaves a trail of labels. To have one label, keep its
handle in a static variable. A static initialiser runs once, on the first bar, so the label is created once; after that, move it
with label.set_xy and change its text with label.set_text.
Delete and re-create
If the label should appear only on the last bar, or you would rather build it fresh than change it (a label’s style can also be changed in place withlabel.set_style), keep the handle in a static variable initialised to na, delete the old label and create a new one on barstate.islast:
static value starts each run at its last committed value, so every tick
starts from the same state.