example.ipynb does not work
See original GitHub issueChart(df,
# style: which mplfinance chart style to use. Added "random" as an option.
# rpad: how many bars to leave empty on the right of the chart
style="yahoo", title=ticker, last=recent_bars(df), rpad=10,
# Overlap Indicators
linreg=True, midpoint=False, ohlc4=False, archermas=True,
# Example Indicators with default parameters
volume=True, rsi=True, clr=True, macd=True, zscore=False, squeeze=False, lazybear=False,
# Archer OBV and OBV MAs (https://www.tradingview.com/script/Co1ksara-Trade-Archer-On-balance-Volume-Moving-Averages-v1/)
archerobv=False,
# Create trends and see their returns
trendreturn=False,
# Example Trends or create your own. Trend must yield Booleans
long_trend=ta.sma(closedf,10) > ta.sma(closedf,20), # trend: sma(close,10) > sma(close,20) [Default Example]
# long_trend=closedf > ta.ema(closedf,5), # trend: close > ema(close,5)
# long_trend=ta.sma(closedf,10) > ta.ema(closedf,50), # trend: sma(close,10) > ema(close,50)
# long_trend=macdh > 0, # trend: macd hist > 0
# long_trend=ta.increasing(ta.sma(ta.rsi(closedf), 10), 5, asint=False), # trend: rising sma(rsi, 10) for the previous 5 periods
show_nontrading=False, # Intraday use if needed
verbose=True, # More detail
)
output:
[i] Loaded SPY(5262, 62)
[+] Strategy: Common Price and Volume SMAs
[i] Indicator arguments: {'append': True}
[i] Multiprocessing: 16 of 16 cores.
[i] Total indicators: 5
[i] Columns added: 0
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\cbook\__init__.py:1377: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.
x[:, None]
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axes\_base.py:239: FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version. Convert to a numpy array before indexing instead.
y = y[:, np.newaxis]
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-44-f7c14830084c> in <module>
26 # long_trend=ta.increasing(ta.sma(ta.rsi(closedf), 10), 5, asint=False), # trend: rising sma(rsi, 10) for the previous 5 periods
27 show_nontrading=False, # Intraday use if needed
---> 28 verbose=True, # More detail
29 )
<ipython-input-35-df099406cc6a> in __init__(self, df, strategy, *args, **kwargs)
20 # Build TA and Plot
21 self.df.ta.strategy(self.strategy, verbose=self.verbose)
---> 22 self._plot(**kwargs)
23
24 def _validate_ta_strategy(self, strategy):
<ipython-input-35-df099406cc6a> in _plot(self, **kwargs)
340 show_nontrading=self.mpfchart["non_trading"],
341 vlines=vlines_,
--> 342 addplot=taplots
343 )
344
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\mplfinance\plotting.py in plot(data, **kwargs)
610
611 if config['volume']:
--> 612 volumeAxes.figure.canvas.draw() # This is needed to calculate offset
613 offset = volumeAxes.yaxis.get_major_formatter().get_offset()
614 volumeAxes.yaxis.offsetText.set_visible(False)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
400 toolbar = self.toolbar
401 try:
--> 402 self.figure.draw(self.renderer)
403 # A GUI class may be need to update a window using this draw, so
404 # don't forget to call the superclass.
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1647
1648 mimage._draw_list_compositing_images(
-> 1649 renderer, self, artists, self.suppressComposite)
1650
1651 renderer.close_group('figure')
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2626 renderer.stop_rasterizing()
2627
-> 2628 mimage._draw_list_compositing_images(renderer, self, artists)
2629
2630 renderer.close_group('axes')
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs)
1183 renderer.open_group(__name__)
1184
-> 1185 ticks_to_draw = self._update_ticks(renderer)
1186 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1187 renderer)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer)
1021
1022 interval = self.get_view_interval()
-> 1023 tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
1024 if self._smart_bounds and tick_tups:
1025 # handle inverted limits
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in iter_ticks(self)
969 self.major.formatter.set_locs(majorLocs)
970 majorLabels = [self.major.formatter(val, i)
--> 971 for i, val in enumerate(majorLocs)]
972
973 minorLocs = self.minor.locator()
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in <listcomp>(.0)
969 self.major.formatter.set_locs(majorLocs)
970 majorLabels = [self.major.formatter(val, i)
--> 971 for i, val in enumerate(majorLocs)]
972
973 minorLocs = self.minor.locator()
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\mplfinance\_utils.py in __call__(self, x, pos)
1135 else:
1136 date = self.dates[ix]
-> 1137 dateformat = mdates.num2date(date).strftime(self.fmt)
1138 #print('x=',x,'pos=',pos,'dates[',ix,']=',date,'dateformat=',dateformat)
1139 return dateformat
ValueError: Invalid format string
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
339 pass
340 else:
--> 341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
246
247 if 'png' in formats:
--> 248 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
249 if 'retina' in formats or 'png2x' in formats:
250 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
130 FigureCanvasBase(fig)
131
--> 132 fig.canvas.print_figure(bytes_io, **kw)
133 data = bytes_io.getvalue()
134 if fmt == 'svg':
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs)
2047 orientation=orientation,
2048 dryrun=True,
-> 2049 **kwargs)
2050 renderer = self.figure._cachedRenderer
2051 bbox_artists = kwargs.pop("bbox_extra_artists", None)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
508
509 """
--> 510 FigureCanvasAgg.draw(self)
511 renderer = self.get_renderer()
512
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
400 toolbar = self.toolbar
401 try:
--> 402 self.figure.draw(self.renderer)
403 # A GUI class may be need to update a window using this draw, so
404 # don't forget to call the superclass.
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1647
1648 mimage._draw_list_compositing_images(
-> 1649 renderer, self, artists, self.suppressComposite)
1650
1651 renderer.close_group('figure')
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2626 renderer.stop_rasterizing()
2627
-> 2628 mimage._draw_list_compositing_images(renderer, self, artists)
2629
2630 renderer.close_group('axes')
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs)
1183 renderer.open_group(__name__)
1184
-> 1185 ticks_to_draw = self._update_ticks(renderer)
1186 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1187 renderer)
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer)
1021
1022 interval = self.get_view_interval()
-> 1023 tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
1024 if self._smart_bounds and tick_tups:
1025 # handle inverted limits
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in iter_ticks(self)
969 self.major.formatter.set_locs(majorLocs)
970 majorLabels = [self.major.formatter(val, i)
--> 971 for i, val in enumerate(majorLocs)]
972
973 minorLocs = self.minor.locator()
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\matplotlib\axis.py in <listcomp>(.0)
969 self.major.formatter.set_locs(majorLocs)
970 majorLabels = [self.major.formatter(val, i)
--> 971 for i, val in enumerate(majorLocs)]
972
973 minorLocs = self.minor.locator()
D:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\mplfinance\_utils.py in __call__(self, x, pos)
1135 else:
1136 date = self.dates[ix]
-> 1137 dateformat = mdates.num2date(date).strftime(self.fmt)
1138 #print('x=',x,'pos=',pos,'dates[',ix,']=',date,'dateformat=',dateformat)
1139 return dateformat
ValueError: Invalid format string
<Figure size 1200x1000 with 10 Axes>
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
How do I fix a .ipynb file? - Stack Overflow
A possible way to recover corrupted Jupyter notebook files, whether it contains text or not (size = 0KB), is to go to the...
Read more >What to do when things go wrong - The Jupyter Notebook
First, have a look at the common problems listed below. If you can figure it out from these notes, it will be quicker...
Read more >odewahn/ipynb-examples - GitHub
A collection of Notebooks for using IPython effectively. The following notebooks showcase multiple aspects of IPython, from its basic use to more advanced ......
Read more >Cannot upload "Linear Regression Practical Example (Part 2 ...
IPY", and when I click to upload it nothing happens. If I change the extension to ".ipynb" (as it should be), it appears...
Read more >Solve problems with Jupyter Notebooks - coursera.support
If your Jupyter Notebook files have disappeared, it means the course staff published a new version of a given notebook to fix problems...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@twopirllc
Yes, it is very easy to use and working.
Thanks. YH
@yhmickey,
Great! Glad to hear.
Regards, KJ