Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. you
    3. Topics
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    Y
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 11
    • Best 0
    • Groups 0

    Topics created by you

    • Y

      Possible to change 4-hr bar start time?
      General Code/Help • • you

      2
      0
      Votes
      2
      Posts
      116
      Views

      run-out

      @you Normally one would use boundoff as follows:

      cerebro.resampledata( data, timeframe=bt.TimeFrame.Minutes, compression=240, boundoff=180 )

      But sadly when I try to execute this in IB if doesn't work.

    • Y

      How to combine historical plus real time data under IB connection
      General Code/Help • • you

      2
      0
      Votes
      2
      Posts
      368
      Views

      A

      Based on the docs Docs - Interactive Brokers - IBData parameter backfill_from specifies

      An additional data source can be passed to do an initial layer of backfilling. Once the data source is depleted and if requested, backfilling from IB will take place. This is ideally meant to backfill from already stored sources like a file on disk, but not limited to.

    • Y

      Backtrader 1.9.46.116 - Is docheckover declaration missing in resamplerfilter.py __call__
      General Code/Help • • you

      3
      0
      Votes
      3
      Posts
      855
      Views

      B

      Affecting only replaying. This commit should alleviate the situation

      https://github.com/mementum/backtrader/commit/26dbab587fdc360c6fbd0617d21da88e2cc9c941

    • Y

      Bbands using Ema instead of sma
      General Code/Help • • you

      5
      0
      Votes
      5
      Posts
      1687
      Views

      Y

      Thanks - will test with the latest version

    • Y

      next() not generated anymore after "IB and Trader Workstation connectivity lost"
      General Code/Help • • you

      26
      0
      Votes
      26
      Posts
      6809
      Views

      B

      Also IB Gateway version 978 seems stable and reconnects seemingly better than the older versions like 972. It also has a "log in once a week" feature, that works. If you're on foreign IB site like Canada's 972 is all it offers. Download 978 (the most recent version) from the US site.

    • Y

      IndexError: deque index out of range
      General Code/Help • • you

      2
      0
      Votes
      2
      Posts
      2953
      Views

      B

      You are using replay and mixing several data feeds. The current core is known (@RandyT has been the driving force) to have some weaknesses with replay.

      The suggestion for such a mix would be to use resample

    • Y

      next() called multiple times within timeframe and bid/ask availability
      General Code/Help • • you

      4
      0
      Votes
      4
      Posts
      2194
      Views

      B

      @you said in next() called multiple times within timeframe and bid/ask availability:

      With IB LIVE data, when using resample and replay e.g. (data, timeframe=Minutes, compression=5), if there is really no market event triggered within the 5 minutes e.g. from 10:00am to 10:05am, no bar will be generated at 10:05am as next() has not been called due to lack of data trigger. Is there available option or standard mechanism that can force generation of the 10:05am bar or it has to be implemented locally? I thought I have the qcheck=0.5 default to force this but seems it has no effect.

      qcheck does only indicate how often the feed will wake up to see if it can deliver. If there is nothing, nothing can be delivered and nothing will be delivered. The data feed (or the resampler) cannot fabricate data out of thin air.

      With IB LIVE data, when using replay(data, timeframe=Minutes, compression=5), next() will be called for each tick received within the 5 mins compression period with the same len(self.data0) value e.g. len(self.data0)=299 between 10:00am to 10:05am. Is there a standard mechanism in next() that I can dintinguish the intra-period ticks and the end of period tick? Or do I need to check the event time e.g. look for event time at e.g. 10:05:00.000000

      You can only know that the resampling of the specific bar is over when the len changes. The replay mechanism cannot know when the replay is going to be over. It will be over either because an incoming timestamp goes over the next boundary or because the real-time clock has gone over the boundary (plus more or less the value of qcheck)

      With IB LIVE data, when using resample(data, timeframe=Minutes, compression=1), sometime next() will be called multiple times at start of a minute e.g. 10:00am but with exact same values (open, high, low, close and indicators). I have checked the time and sales in IB and there is no trades happened from 09:59:59am and 10:00:01am so wonder what may trigger the duplicate next() call

      If the assumption is that this could be an error, one would need a sample and data.

      But this is most likely due to a timestamp coming in which belongs to the previous minute, but cannot be delivered with the previous minute because that one is out. In realtime, that timestamp is delivered with the next minute. Looking at historical data gives a different view of course

    • 1 / 1