Hollow Candles
Description
Is there any way to add hollow candles or another type of candles like the tradingview app?
This is what I'm expecting:
This is the actual chart
Code example
I think we can change here the code to add another validation to convert the candles
def candle_style(
self, up_color: str = 'rgba(39, 157, 130, 100)', down_color: str = 'rgba(200, 97, 100, 100)',
wick_visible: bool = True, border_visible: bool = True, border_up_color: str = '',
border_down_color: str = '', wick_up_color: str = '', wick_down_color: str = ''):
"""
Candle styling for each of its parts.\n
If only `up_color` and `down_color` are passed, they will color all parts of the candle.
"""
border_up_color = border_up_color if border_up_color else up_color
border_down_color = border_down_color if border_down_color else down_color
wick_up_color = wick_up_color if wick_up_color else up_color
wick_down_color = wick_down_color if wick_down_color else down_color
self.run_script(f"{self.id}.series.applyOptions({js_json(locals())})")
Method of implementation
No response
`bg_col= '#000000' # Pick Background color up_col= '#acfb00' # Pick Green candle color dn_col= '#ff0000' # Pick Red candle color
chart.layout(background_color=bg_col) chart.candle_style(up_color=bg_col, down_color=bg_col, border_up_color=up_col, border_down_color=dn_col, wick_up_color=up_col, wick_down_color=dn_col) # Set candle up_color and down_color to the same as background_color ?`
`bg_col= '#000000' # Pick Background color up_col= '#acfb00' # Pick Green candle color dn_col= '#ff0000' # Pick Red candle color
chart.layout(background_color=bg_col) chart.candle_style(up_color=bg_col, down_color=bg_col, border_up_color=up_col, border_down_color=dn_col, wick_up_color=up_col, wick_down_color=dn_col) # Set candle up_color and down_color to the same as background_color ?`
I just updated the requirement to be more specific in the definition of Hollow Candles
`bg_col= '#000000' # Pick Background color up_col= '#acfb00' # Pick Green candle color dn_col= '#ff0000' # Pick Red candle color
chart.layout(background_color=bg_col) chart.candle_style(up_color=bg_col, down_color=bg_col, border_up_color=up_col, border_down_color=dn_col, wick_up_color=up_col, wick_down_color=dn_col) # Set candle up_color and down_color to the same as background_color ?`
This works; for transparency you may be able to add another field to your ohlc data (https://tradingview.github.io/lightweight-charts/tutorials/customization/data-points#result)
I think we have a confusion here. With the Data we have on OHCL we should build Hollow Candles, we dont need another field on the data set. This is wrong. Please, check another libraries or the Original Trading View Chart>