So I can loop through all my data in the Next..
self.datas is an array and you can loop over it.
How do I plot the portfolio performance? instead of backtrader printing 1000 different charts...
Depends on what you have defined as performance for your portfolio. There is for example a TimeReturn observer which is intended to plot exactly what the name implies.
If you want to plot other performance indicator, you will need to define it as an indicator or observer
The default is to plot the evolution of the cash and the actual portfolio value which should give a quick indication as to where the system is
And only a single chart will be printed per strategy.
Is there an integrated solution to do this in Backtrader?
There are several samples, blog and documentation pages. See for example:
Docs - Benchmarking
Here the performance is defined as the comparison against another asset.
@bernardlin said in How do I set up correct position close logic?:
Hi, would you mind providing me a link on how 'define a CommissionInfo object which converts the profit and loss (and commissions) of the given pair to your base currency' is done
"Discussed" is not the same as developed.
The problem here is that the broker, being unaware of the order being issued during next_open, tries to see if you are submitting an order which exceeds your current cash reserves (and the current price is already the close)
You can disable the submission check with checksubmit=False. See Docs - Broker
And this other topic for example: https://community.backtrader.com/topic/782/help-with-simple-bband-strategy
@yi-fang said in I want to apply multiple filters to a stock universe of 193 stocks:
Even if it was another indicator, the original data info should be pass by.
An indicator can have many inputs and these can belong to multiple data feeds, indicators and ...
@vbs while optimize encountered different situation according different strategy, some very simple may run seccessfully,some complicated may not run,some unique may just walk and have no error reporting.I don't have so much time and experience to debug this.Now,I debug the analyzers,there are some errors.
Interesting. In your script you apply the indicator to the self.data0 ie 5 min data feed, but indicator itself works with the self.data1 which is daily bars. I would assume that self.addminperiod is also applied to minutes data feed, so you need lot to get 5 bars of daily data feed.
Try this (didn' run it by myself):
lines = ('dayHigh',)
params = (('period', 5),)
self.dayHigh = self.data.high[-self.p.period]
call in the strategy:
self.dayHigh = dummyIndicator(self.data1)
@Jiayu-Chen said in [Errno 2] No such file or directory:
@vladisld said in [Errno 2] No such file or directory:
Thanks! It worked!
It still doesn't work for me.
Could you attach the yahoo.py to me?
Available with this commit in the development branch: https://github.com/mementum/backtrader/commit/aba90a3ff4e115e3373ea15389410adf10f2b4cf
The regular IB functionality doesn't seem broken by these changes.