I am working thru my first script using Pine and came across a spot I have been struggling on for 2 hours.
All I am trying to do is show 'strValueBarAverage' above the current bar. After the bar has closed and moved onto the newest bar, I would like the original to be deleted and the newest bar to again have the 'strValueBarAverage' value above it. Right now, it is just layering each Bar's data above, making it unreadable. Code below and thank you.
if barstate.isrealtime and barstate.islast
myLabel = label.new(x=bar_index, y=close, color=color.orange, textcolor=color.white, style=label.style_circle)
label.set_text(id=myLabel, text=strValueBarAverage)
if not(barstate.islast)
label.delete(myLabel)