@backtrader "because when it calls your next (method with logic) the guarantee is that all buffers (data, indicators) have something. But you want some options only from a given point in time, breaking the entire system."
why should that be the case? NaN / missing values could be added into a series that spans 3 months across your 10 years worth of data. then you really may have multiple such data feeds that would be "active" / providing value just for a sub-set of your timeline. still, some built-in / helper functionality would be useful in "homogenizing" all these small time-span option series. would this be possible?
@MrKalindro thanks. I was able to get it working with Matplotlib 3.2.2 by changing one line - line 264 - in plot.py. Specifically, I added visible=True.
259: # Applying fig.autofmt_xdate if the data axis is the last one
260 # breaks the presentation of the date labels. why?
261 # Applying the manual rotation with setp cures the problem
262 # but the labels from all axis but the last have to be hidden
263 for ax in laxis:
264 self.mpyplot.setp(ax.get_xticklabels(), visible=True)
I have another question. How can I set the frequency of the ticks in the x-axis (date axis)? I want to set the ticks to appear more frequently (ex: every 2 weeks, or every month) instead of once every 2 months.
In order to understand what is going on in your script, log the values of the prices and indicators from the prenext() and next() calls on an hourly basis. In this case you will move from guessing to knowing.
It seems that PandasData column index auto-detection mechanism is broken in case the input dataframe contains no column names ( using indexes instead).
I suspect the following commit has introduced the regression:
05051890efe527ee22919d354038b4dfc1ffe7ca: Rework ix -> iloc pull request and autodetection algorithm in PandasData
Opening the issue to track this:
@vladisld Thank you for your answer! However I got another error from that inheriting part : "feed" since I don't know about backtrader very much yet so I googled but couldn't find how to import relevant module to find "feed" class. ..