Reputation: 45
For a new indicator on tradingview in pine script, I like to plot a curve using only candle values that qualify my contition. For example candle 1, candle 4 and canle 7. All other should not be used for plotting. The if statement does not accept a plot function inside the if statement.
How do I plot only for selected candles?
Regards Sven
Upvotes: 1
Views: 1396
Reputation: 2821
//@version=3
study("My Script")
// it must work like that:
// plot(n == 1 or n == 4 or n == 7 ? close : na)
//but there's a bug, so you can do it changing a color:
col = n == 1 or n == 4 or n == 7 ? blue : white
plot(close, color=col)
Upvotes: 0