Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display indicator value without plotting anything

Tags:

pine-script

I am trying to modify a pine script indicator on TradingView so that it displays the value of the indicator/plot next to the title of the indicator on the main chart. However, I don't want to actually plot anything because it messes up the scale of the chart. I also don't want it to show up in a separate window above or below the chart. Is this possible with Pine Script?

enter image description here

I attempted passing in display=display.none to the "plot" function, but that removed both the value label and the line. Here is the code (image example does not have "display" parameter):

//@version=4

study(title="ADR %", overlay=true)
length = input(20, title="length")

dhigh = security(syminfo.tickerid, 'D', high)
dlow  = security(syminfo.tickerid, 'D', low)

adr = 100 * (sma(dhigh/dlow, length) - 1)

plot(adr, title="ADR %", display=display.none)
like image 870
Nick Nelson Avatar asked May 01 '26 09:05

Nick Nelson


1 Answers

Using plot with tranp=100 will work but it can mess up the chart scale. I usually use the plot character function to accomplish this because you can set the location to top or bottom so it doesn't impact the scale. Just set the character to "" so it doesn't put anything on the chart. Something like this:

plotchar(adr, title="ADR %", char="", location=location.top)

like image 119
kmarryat Avatar answered May 04 '26 13:05

kmarryat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!