'How to plot something if a Boolean value is TRUE? Pine Script V5
Here's my simplified code:
PlotOrNot = input.bool(true, title="Plot it", inline = "01")
plot(SomethingCalculated, "Calculated Thing", color=color.blue, offset = offset)
As I found here, there's a way to tell the plot command to do the plot in case the Boolean value is true but I could not manage to make it not turn into error messages.
Solution 1:[1]
Use it in the series argument of the plot().
plot(PlotOrNot ? SomethingCalculated : na, "Calculated Thing", color=color.blue, offset = offset)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vitruvius |
