2019-10-02: The community is currently in read-only mode
Benchmark observer bug?
I am a novice regarding backtrader and also python but it is great fun to learn and use the platform. Great work by all involved!
Today I tried the Benchmark observer and noticed that the return from the strategy is different than when using the TimeReturn observer. Is this a bug (missing negative sign for return of strategy in benchmark observer) or is it possible that I am missing something. See attached plot image.
Thanks in advance!
Benchmarkobserver simply is an extension of the
TimeReturnobserver and as such there is no difference when it comes to sign, because the same code is responsible.
Would you mind sharing how you actually invoke the observers? Even if a chart seems to show something it actually shows nothing.
Sorry, here is the code.
self.cerebro.addobserver(bt.observers.BuySell) self.cerebro.addobserver(bt.observers.Value) self.cerebro.addobserver(bt.observers.TimeReturn, timeframe=bt.TimeFrame.NoTimeFrame) self.cerebro.addobserver(bt.observers.Benchmark, data=self.data_benchmark, timeframe=bt.TimeFrame.NoTimeFrame)
If I activate cheat-on-close the difference is even bigger.
Hm, I found another issue in my code. I'll try to sort that out first to see if it's related somehow.