One thing you can try:
cygwin(i.e.: bash in mintty) as the shell
- Put the location of the
python.exefrom your chosen distribution in the
And you get the best of both worlds
Just by looking at the values it would seem that your data doesn't move 20 points altogether in an entire year. You need to fine tune the Renko filter to your data set. There is no one size fits all for it.
# Get Apple data from Yahoo Finance data = bt.feeds.YahooFinanceData( dataname = 'AAPL', fromdate = datetime(2016,1,1), todate = datetime(2017,1,1), buffered = True )
If I had to bet that is returning no usable data. It is well-known that Yahoo has crippled the API (shut down the old and made the new one unusable)
def next(self): if self.dataclose < self.dataclose[-1]: if self.dataclose[-1] < self.dataclose[-2]: self.buy()
You could try to print the closing values there to check what's happening.
Solution: use a different data file (a csv file is good enough)
So I am curious to know thoughts on comparison between backtrader and Pyalgotrade ?
I haven't used
pyalgotrade but I read this:
And I have seen threads by the author that he gave
pyalgotrade a try and didn't like the API. And that was the reason to start
Also, my goal is to backtest strategies for cryptocurrencies, will backtrader come to the rescue ?
There is no reason as to why not. Check this thread which is always active:
Anaconda (as a distribution) and ipython, spyder, etc. (as shells) are ok. Nothing against it. If you want interactivity, saving your work with charts embedded, coming back and making edition in between cells.
They simply impose restrictions (like the mentioned one for the
multiprocessing module under Windows) which you need to be aware of.
You may want to have a look at PyCharm as integrated environment (execution of scripts inside
PyCharm* suffers from the same pitfalls as above)
But serious jobs are better executed from the command line (Cygwin under Windows offers a fantastic Unix-like experience and the WSL is already mature enough for many things)
@way-to-java said in Problem while getting started.:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The warnings seem clear. You are running the code inside one of the shells that hijack the start of the Python kernel and do horrible things to it.
Run the code in a normal shell and things will work.
You can also find references in the community (and in StackOverflow) that
multiprocessing is also not compatible with such shells under Windows. I.e.: if you cannot run an optimization using all cores, only 1 core will be available to you under Windows.
But in any case it doesn't seem like the code is broken and you probably have a plot.
Although it may not seem obvious to you:
If you don't show the code there is little that can be done. Yes, you pointed out that you were following the quickstart guid, but you have probably modified things. At least to find the data feed.
You can help if you also show a couple of lines of the actual data downloaded. Because it seems that the data you have has characters which aren't numbers in the datetime part. That's something you can look up yourself.
To post the code and a fragment of the data and properly format, see at the top of the forum for the 3-ticks hint.
The right question here would be not "how you count it" but how brokers (usually) count it. My personal experience with different brokers is that there is no "bar based" system.
Bars can have many different durations (
2-days), you would have to 1st define the actual bar duration and then the length. You would also have to take into account that during thin trading sessions, several
1-min bars will be missing (no negotiation took place). Should they count because your expected timeframe is
1-min or shall the broker be counting only those with executed volume?
Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.