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/

    Need clarification on cheating/replay/timers to buy at open and sell minutes before it closes

    General Code/Help
    1
    2
    50
    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.
    • B
      booboothefool last edited by

      So on the 1H chart, I am just trying to buy when a candle opens and sell 5 minutes before it closes.

      I've read some docs:
      https://www.backtrader.com/blog/posts/2017-05-01-cheat-on-open/cheat-on-open/
      https://www.backtrader.com/docu/data-replay/data-replay/
      https://www.backtrader.com/docu/timers/timers/

      But I kinda need an ELI5 and clarification on what they do.

      To buy at the open, it sounds like cheat-on-open might be what I want. From what I understand, by default things operate on next() when candles close and indicators are recalculated, so it's "cheating" if you try to do something before the complete close of the current candle, so you only have the previous candle close to work with at the open of the current candle, and you don't know where that opening current candle will end up. Am I understanding this correctly?

      Also I'm not sure of the difference between resample and replay, but it sounds like 'replay' might be along the lines of what I want. I also saw that I can add timers. To sell 5 minutes before a candle closes, should I use notify_timer or replay?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • B
        booboothefool last edited by

        Um, this may also be relevant: https://www.backtrader.com/docu/filters-reference/#barreplayer_open

        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(); }); }