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/

    Mechanic of next(self) function. Explain me please by experience

    General Discussion
    3
    9
    148
    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.
    • SPECULARI FUND
      SPECULARI FUND last edited by

      Last 2 days I am testing live data feed. I noticed, that first resample timeframe is major for "next(self):" function. right?
      So, if all logic calculates inside of this "loop" it will calculates at the same "speed" as your major timeframe, right?
      My major resample timeframe is 1 minute, and when I receive signal my order create and it executes after 1 minute...or I am wrong? On backtesting I didn't understant this moment untill try live data, so looking for asnwer from experienced guys. Thx!

      1 Reply Last reply Reply Quote 0
      • Yaroslav Horyslavets
        Yaroslav Horyslavets last edited by

        If you place an order, it will be execute on the next bar by open price. If you send order to broker, and this order is market - it will be execute from order book(from takers).

        SPECULARI FUND 1 Reply Last reply Reply Quote 1
        • Yaroslav Horyslavets
          Yaroslav Horyslavets last edited by

          Sorry, *if you send order to broker in live mode

          1 Reply Last reply Reply Quote 0
          • SPECULARI FUND
            SPECULARI FUND @Yaroslav Horyslavets last edited by

            @Yaroslav-Horyslavets thx for reply. Looks like I can't understand it because I test it without broker platfrom (only live feed) and my logs show after each "next()".

            1 Reply Last reply Reply Quote 0
            • A
              ab_trader last edited by

              next() is called on every bar of all data feeds (resampled or not resampled).

              • If my answer helped, hit reputation up arrow at lower right corner of the post.
              • Python Debugging With Pdb
              • New to python and bt - check this out
              SPECULARI FUND 1 Reply Last reply Reply Quote 0
              • SPECULARI FUND
                SPECULARI FUND @ab_trader last edited by

                @ab_trader how to check what minimal timeframe data feed can send?

                1 Reply Last reply Reply Quote 0
                • A
                  ab_trader last edited by

                  have the data feeds names related to the time frames. print data feed self.datas[x]._name name on each next() using log function. this will also give the date and time.

                  • If my answer helped, hit reputation up arrow at lower right corner of the post.
                  • Python Debugging With Pdb
                  • New to python and bt - check this out
                  SPECULARI FUND 1 Reply Last reply Reply Quote 2
                  • SPECULARI FUND
                    SPECULARI FUND @ab_trader last edited by

                    @ab_trader all my questions about orders event handling. But I understand that if I had broker terminal I wasn't confused with logs output and next(). Anyway, thank you for replies!

                    1 Reply Last reply Reply Quote 0
                    • A
                      ab_trader last edited by

                      In this case I am not sure what is your confusion. Live broker or simulation broker - approach is the same.

                      • If my answer helped, hit reputation up arrow at lower right corner of the post.
                      • Python Debugging With Pdb
                      • New to python and bt - check this out
                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      • First post
                        Last post
                      Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors