Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Bug in timers?

    General Code/Help
    1
    1
    33
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      chewbacca last edited by

      Using daily dataset and several SMA over short & long period, I get normal values when using the next() function to calculate values and execute trades, but if I place a timer and move the logic from next() into notify_timer(), for example:
      self.add_timer(
      when=dtm.time(9, 31),
      offset=dtm.timedelta(),
      repeat=dtm.timedelta(),
      weekdays=[],
      )

      The timer executes, but there are gaps of several days here and there in the SMA data with the exact same dataset.
      Why notify_timer() doesn't see the precalculated values of the SMA properly the same way next() sees them?

      Here is an example using Yahoo daily dataset of SPY:
      2020-05-20, DATA
      2020-05-21, DATA
      2020-05-22, DATA
      2020-05-26 NO DATA (timer doesn't execute?)
      2020-05-27, DATA
      2020-05-28 NO DATA (timer doesn't execute?)
      2020-05-29, DATA

      Where as if the logic is in next(), all days have data

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
      $(document).ready(function () { app.coldLoad(); }); }