This is strange indeed. In case you see the print inside the if not self._statelivereconn: - if we follow the code flow - it seems nothing should prevent issuing another subscription. It means that the appropriate request should have been seen in the API logs - but apparently it did not.
On another note:
Just compared the patch in the master branch of mementum\backtrader repository and my fork and there are some differences. In particular the patch in mementum\backtrader lacks the subscription cancellation code.
I'll upload the updated PR in the coming days after additional testing.
You may try to use my fork (https://github.com/vladisld/backtrader in 'lazytrader' branch) or just take a diff of ibdata.py and ibstore.py from there and see if it works for you until the updated PR will be uploaded.
I don't have example code to do that in this particular case because I don't reset the VWAP each day, I just use a running tally.
You may wish to consult this thread which will show you that getting datetimes in an indicator can be a challenge: https://community.backtrader.com/topic/489/getting-the-current-date-in-a-strategy-s-next-method/2
I have done it (iirc) by passing the datafeed separately into the indicator as datas and the line that I'm operating the indicator on as datas.
So in my indicator I can filter (or in your case you can reset the VWAP) within the indicator based on the date:
curdt = self.datas.datetime.date(ago=0)
curtm = self.datas.datetime.time(ago=0)
And my line calculation input is in datas. And I call passing both the data line and the input line that I'm working on:
x = DistPercentileSampled(d, self.inds[d]['highdiffs'], period=780, raw=True, bar_size=30, matchwkdy=False, inputdesc='SELL_disthighdiffs', subplot = False)
d is datas and self.inds[d]['highdiffs'] is datas within the indicator.
You should consider trying simple examples until you get the concepts and then tackle the strategy you want to execute here. This forum it's difficult to back up and give you the entire lesson of backtrader. Dive into the manuals and once you are ready, tackle your code. Then we will help you solve your problems. It takes time.
I found the issue. I was assigning the stop order from bracket order into self.stop.
self.order, self.stop, self.limit = self.buy_bracket(size=self.p.order_size,
price=self.data.high[-1] + self.p.order_lvl_buffer,
Hi @Rubén-Briones , @sksuram
Did either of you haven any luck with this? I also think I'm having a similar issue whereby I get a 'IndexError: array assignment index out of range' exception raised from linebuffer.py
Hey Bo, Im very curious about your Renko implementation. Im just starting to work with backtrader. So, cant provide much prior knowledge. But since this Indicator is on our bucketlist, Ill implement it myself. Id be super happy to see your new version
@ab_trader Ok so everything is working now. So the reason for the errors was that in the init for my strategy I initialized the self.gamma variable with gamma1(self.data).dummyline. That was my mistake I should have deleted that .dummyline.
I think I go confused for a bit and accidentally put that there in the init of my strategy. I also used self.line.dummyline in the next() of my strat. which should be used in my indicator class not strat class.
Bunch of dumb mistakes I made. HUGE thanks to @ab_trader and @run-out for helping me out, and clarifying many aspects of BT for me.