Trading View Pine Script : How to Plot Single Character '❄' on Highest Yearly Candle and keep updating

53 views Asked by At

How to plot Character '❄' on Yearly Highest Candle and Keep updating. The old character should delete when a new yearly high is created There should only be one Character '❄'on the Yearly Highest Candle

study("High Yearly", overlay=true)

hyl = input(true, title="High Yearly Line")
yhigh = security(tickerid, '12M', high) 
//plot(hyl and yhigh ? yhigh :na , title="Yearly_High",style=circles, color=yellow, linewidth=3) 
plotchar(hyl and yhigh ? yhigh :na , char='❄')

Error: Multiple Characters '❄' plotted and old not deleted

1

There are 1 answers

2
karatedog On

You need to align your expectation (or specification) with the tool you are using to achieve that.

  1. plotchar does not accept a positional parameter hence "keep updating" is not possible with plotchar
  2. Also, you cannot delete a character on a past candle when it has been drawn already (this, also hinders "keep updating")

You need to use something else, like Labels or drawing elements, which can return an ID when created and you can modify their position later, backreferencing that ID.