Hide plot only some of the time?



New member
You can hide or show your plot programmatically with the function “SetHiding()”. The argument should be 0 for show, 1 for hide. If you wanted to show our EMA only when price was above today’s open, you could use this code:

myindicator.setHiding(if close>open(period="DAY") then 0 else 1);

Note that this will either hide or show THE ENTIRE plot based on the results of the “if” test in real time.

https://usethinkscript.com/threads/dynamically-hide-part-of-plot.2478/ gives the strategy of using the background color, but this still draws over other plots on the chart.

plot_name.AssignValueColor(if show_condition_is_true then color.red else CreateColor(22,22,22));

Is there no other way to turn off plots during certain conditions only?

Similar threads