Observer overwriting issue
I made many custom codes on backtrader, so it's hard for me to explain the exact situation.
But I'll try, and I'd be very thankful if you can save me from this.
- I use multiple strategies in a portfolio
- I use an observer on each of the strategy, added with
cerebro.addobserver, as usual
- I have currently ~ 20 strategies running in my portfolio
- My observer has two lines, "date" and "pnl"
The issue :
When I go into the "next" method, I print :
bt.num2date(self._owner.lines.datetime), to see the current date "in the owner strategy"
self.lines.date(before writing anything inside) to see if
self.lines.dateis nan or not
In rare cases,
self.lines.datealready has something written inside, which is actually what I wrote in the previous iteration of next for the "previous"
The question :
How is it possible to overwrite something using only
self.lines.date? Why does it not "advance" in time?
My hypothesis :
My datas in different strategies have different datetime / trading days, especially for some special dates like Christmas or Easter Monday, and this could cause some trouble in "advancing" in the lines.
Sorry for my english, and my "not-quite-clear" issue.
Stay healthy everyone :)