rohan sawant
rohan sawant

Reputation: 121

TradingView using plotcandle, to color candle Wicks . But these Wicks still remain when chart is changed to line chart. How do i auto hide them?

TradingView using plotcandle function, to color candle Wicks.

But these Wicks still remain when the chart is changed to line chart.

How to auto-hide/disable them when I change the chart type to line?

//@version=4
study("5 ema", overlay=true)

x = ema(close, 5)
x1 = sma(x, 5)

y = x >= x1
y1 = x <= x1

f_check() => high != 0 and open != 0 and low != 0 

red        =    color.new(color.red, 0)
green      =    color.new(color.green, 0)


f_red()     =>  f_check() ? color.new(color.red, 0)     : color.new(color.red, 100)
f_green()   =>  f_check() ? color.new(color.green, 0)   : color.new(color.green, 100)


f_wickcolor() => y ? f_green() : y1 ? f_red() : color.new(color.black, 0)

f_bordercolor() => color.new(color.black, 100) //f_wickcolor()


plotcandle( open, high, low, close, color = color.new(color.white, 100), wickcolor = f_wickcolor(), bordercolor = f_bordercolor(), display = display.all )

Upvotes: 0

Views: 1452

Answers (1)

rumpypumpydumpy
rumpypumpydumpy

Reputation: 3823

You can't as there is no method to detect which type has been selected from the toolbar using pine.

The only workaround is to set your chart to line and set the color to be fully transparent (invisible). Then code in your line/candle option manually and plot the full candle bodies and wicks or a line instead.

Upvotes: 0

Related Questions