diff --git a/README.md b/README.md index 85b02ae..0d3042e 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,26 @@ t1data.ohlcv.data["BAC"].lw.plot(auto_scale=macd) ![alt text](image-6.png) ```python -#quick few liner, displays close series with label "close" on right pricescale and rsi on left price scale, all on single Panel +#ONE PANEL - quick few liner, displays close series with label "close" on right pricescale and rsi on left price scale, all on single Panel pane1 = Panel( right=[(close, "close")], left=[(rsi,"rsi")] ) ch = chart([pane1]) +##ONE PANEL - quicker +Panel( + auto_scale=[cdlbreakaway], + ohlcv=(t1data.ohlcv.data["BAC"],entries), + histogram=[], + right=[], + left=[], + middle1=[], + middle2=[] + ).chart(size="s") +``` +![alt text](image-7.png) +```python # display two Panels # on first displays ohlcv data, orderimbalance volume as histogram with opacity, bbands on the right pricescale and # sma with short_signals and short_exits on the left pricescale diff --git a/image-7.png b/image-7.png new file mode 100644 index 0000000..4b42225 Binary files /dev/null and b/image-7.png differ diff --git a/lightweight_charts/helpers.py b/lightweight_charts/helpers.py index 130c632..c9f22da 100644 --- a/lightweight_charts/helpers.py +++ b/lightweight_charts/helpers.py @@ -10,7 +10,7 @@ ohlcv_cols = ['close', 'volume', 'open', 'high', 'low'] right_cols = ['vwap'] left_cols = ['rsi', 'cci', 'macd', 'macdsignal'] middle1_cols = ["mom"] -middle2_cols = ["updated"] +middle2_cols = ["updated", "integer"] histogram_cols = ['buyvolume', 'sellvolume', 'trades', 'macdhist'] def append_scales(df, right, histogram, left, middle1, middle2, name = ""): @@ -246,6 +246,18 @@ class Panel: ch = chart([pane1]) + # or simply: + + Panel( + auto_scale=[cdlbreakaway], + ohlcv=(t1data.ohlcv.data["BAC"],entries), + histogram=[], + right=[], + left=[], + middle1=[], + middle2=[] + ).chart(size="s") + # Synced example pane1 = Panel( ohlcv=(t1data.data["BAC"],), #(series, entries, exits, other_markers) @@ -303,8 +315,10 @@ class Panel: self.xloc = xloc self.precision = precision - -def chart(panes: list[Panel], sync=False, title='', size="m", xloc=None, session = slice("09:30:00","9:30:05"), precision=None, **kwargs): + def chart(self, **kwargs): + chart([self], **kwargs) + +def chart(panes: list[Panel], sync=False, title='', size="s", xloc=None, session = slice("09:30:00","9:30:05"), precision=None, **kwargs): """ Function to fast render a chart with multiple panes. This function manipulates graphical output or interfaces with an external framework to display charts with synchronized diff --git a/lightweight_charts/util.py b/lightweight_charts/util.py index 93f4082..bb28b4b 100644 --- a/lightweight_charts/util.py +++ b/lightweight_charts/util.py @@ -113,7 +113,7 @@ def is_vbt_indicator(variable): # Get the module path of the variable's type module_path = variable.__class__.__module__ # Check if it starts with 'vectorbtpro.indicators' - return module_path.startswith('vectorbtpro.indicators') + return module_path.startswith('vectorbtpro.indicators') or module_path.startswith('indicators.') class Pane: def __init__(self, window): diff --git a/setup.py b/setup.py index 5b5f4de..c9cb2d4 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f: setup( name='lightweight_charts', - version='2.2.4', + version='2.2.5', packages=find_packages(), python_requires='>=3.8', install_requires=[