1
votes

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)

Thank you!!

2

2 Answers

2
votes

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)

0
votes

I solved this problem by setting the transparency to 100% in the pine script code and then changing the settings of the chart to only scale the price chart.