# Candlestick plot: how to remove non-trading periods?

**URL:** <https://discourse.holoviz.org/t/candlestick-plot-how-to-remove-non-trading-periods/4437>\
**Category:** hvPlot\
**Tags:** hvplot\
**Created:** [October 24, 2022, 3:59am UTC](https://discourse.holoviz.org/t/candlestick-plot-how-to-remove-non-trading-periods/4437 "2022-10-24T03:59:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/jan/32/3814_2.png) [@Jan](https://discourse.holoviz.org/u/Jan)\
**Post date:** [October 24, 2022, 3:59am UTC](https://discourse.holoviz.org/t/candlestick-plot-how-to-remove-non-trading-periods/4437/1 "2022-10-24T03:59:24Z")

</div>

Hi,

It’s really great that `hvplot` has a candlestick chart (called `ohlc`).

But is there a way to get rid of the non-trading periods in the hvplot candlestick charts? I tried converting the index to strings (error) or to categories (looks weird). The only thing that seems to work is a purely numerical index. @Marc, maybe are interested in this issue?

The standard in finance is that those gaps are removed (don’t ask me why, but it’s true). Every single software / platform / (scientific) publication does it like that.

```python
import pandas as pd
import numpy as np
import hvplot.pandas

days = 50

open = np.random.randn(days).cumsum() # sorry, overwriting built-in function for clarity
close = np.append(open[1:], open[-1]+np.random.random_sample())
high = np.maximum(open,close) + np.random.lognormal(sigma=0.5, size=days)/3
low = np.minimum(open,close) - np.random.lognormal(sigma=0.5, size=days)/3

df = pd.DataFrame([open,high,low,close], index=['open','high','low','close']).T
df.index = pd.period_range(start='2022-01-01', periods=days, freq='B').to_timestamp()

df.hvplot.ohlc()

```

### hvplot

 ![Screen Shot 2022-10-23 at 11.35.54 PM](https://discourse.holoviz.org/uploads/default/original/2X/e/e6870b895e645bd8095f48f385ec99d3b6bac010.png)

### Standard trading platform

 ![Screen Shot 2022-10-24 at 12.22.59 AM](https://discourse.holoviz.org/uploads/default/original/2X/5/5c5001949c0fc5946dd62bc82360bffc4a840f13.png)

Just as a note how this is done in finance: On daily charts, weekends and market holidays are removed, on intraday charts, periods with no trading activity are removed, even when the market was open.

Sometimes charting software has a setting to show intraday periods where the market was open, but no trading happened. But for that the software has to know the trading hours for each instrument, which can be complex due to different holiday schedules (never mind timezones).

Also: the current chart type is called `ohlc`, but `ohlc` charts are actually something else (also called bar charts). they should be called `candlestick`.

Another thing I was looking for is to make the outline of the candlestick box invisible. Currently, if I set `line_width=0`, then also the tails/wicks disappear.

In addition, the parameter `bar_width` is pretty hidden. It is not described for example in `hvplot.help('ohlc')`.
