4

I have recently created a script that plots several different indicators on a chart in TradingView. Under specific scenarios, some of the indicators are not active and show "n/a" in the data window.

I know that TradingView allows us to hide all indicator values. I would like to customize which indicator values are visible. Is this possible? Thanks for your time.

Ken White
  • 123,280
  • 14
  • 225
  • 444
Arvi
  • 41
  • 1
  • 1
  • 2

4 Answers4

8

You can disable plot visibility by using display = display.none, but the parameter's argument cannot be dynamic nor even controlled by Inputs because it's of const form. So that's probably no use for you.

While you can control plot values and color dynamically, once you plot na, "n/a" will appear as the value in the Data Window and afaik we can't make it invisible.

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21
  • Thank you very much for following up. I appreciate it. – Arvi Aug 17 '20 at 14:44
  • Thanks for the help! – flk Oct 15 '20 at 19:17
  • It would be awesome to have a solution for this. Unused dynamic value can occupy a lot of space in the window. I've made a series of EMAs which display different values for different timeframes. So, I have around 15 unused values ("n/a" values) from other timeframes different than the one under use. – carloswm85 Jan 29 '21 at 18:47
  • An extension to the argument list to [`plot()`](https://www.tradingview.com/pine-script-reference/v4/#fun_plot)'s `display` parameter is planned. It will allow us to control more precisely exactly where values are visible, including in the indicator values. The argument is of "const int" type, however, which means you won't be able to dynamically turn the display on/off depending on the plotted values, so would prolly not be of help for the situation you mention. – PineCoders-LucF Jan 29 '21 at 23:39
  • Why not just make it dynamic instead of imposing these awkward limits on the visibility control? – Adam Spiers Mar 21 '21 at 13:16
  • Because the current runtime architecture requires some script properties to be known before the script executes, hence the "const integer" type requirement of `display`'s argument. – PineCoders-LucF Mar 21 '21 at 15:27
0

try this a_DSS1 is a float. It will by default NOT be checked in the style tab of the settings for the indicator. But checking it makes it appear. You can see here that this line is red if declining and blue if inclining.

https://i.stack.imgur.com/uy2n2.png plot(a_DSS1, title= "S1Slow", color= a_DSS1 < a_DSS11 ? color.red : color.blue,offset=offset, linewidth = 2, display=display.none)

0

Well there is a workaround, for hiding plots. What i did for emas:

transEma7 = input(defval=true,title="ema7")
int ema7Trans=na
if(transEma7 == true)
    ema7Trans := 0
else
    ema7Trans := 100

plot(ema7,title="ema7",color=color.rgb(255,255,0,ema7Trans))

So this code will create a checkbox in your strategy settings and then you can uncheck it, which will set the the ema7Trans variable to 100, which will change the transparency of the color of your plot to 100, which is invisible.

Important! This is just for hiding the drawn part on the chart, the value will still be there and visible, but for finding visual patterns its ok.

cigien
  • 57,834
  • 11
  • 73
  • 112
snymty
  • 1
  • 1
0

Plotting with color "na" will hide the plot from chart and would still show in the data window.

showPlot = input.bool(true)
plot(avg, color=showPlot?color.blue:na)

Source: https://www.tradingview.com/pine-script-docs/en/v5/concepts/Plots.html

Sathesh
  • 6,323
  • 6
  • 36
  • 48