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/

    Why do sometimes an order takes 2 bars to execute while most other times it only took one bar?

    General Code/Help
    2
    2
    85
    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
      brozeki last edited by

      Hello,

      I am having trouble while backtesting, sometimes an order is pending and next() is skipped causing some signal to be missed. Most of the times the orders executed on the next bar once signal is triggered before next() is called. Please advise.

      2017-04-06T10:00:00, BUY CREATE, 2374.25, status:1  ref: 212
      2017-04-06T10:00:00, BUY CREATE, 2374.25, status:2  ref: 212
      2017-04-06T10:00:00, BUY EXECUTED, Price: 2375.50, Cost: 18600.00, Comm 5.00 ref: 212
      2017-04-06T10:00:00, OPERATION PROFIT, GROSS -337.50, NET -342.50
      2017-04-06T22:00:00, SELL CREATE 2370.50, status:1 ref: 213
      2017-04-06T22:00:00, SELL CREATE 2370.50, status:2 ref: 213
      **2017-04-06 22:00:00  PENDING ORDER. SKIP NEXT ref:213**
      2017-04-07T02:00:00, SELL EXECUTED, Price: 2370.25, Cost: 18600.00, Comm 5.00 ref: 213
      
      B 1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators @brozeki last edited by

        @brozeki said in Why do sometimes an order takes 2 bars to execute while most other times it only took one bar?:

        Please advise.

        Advice:

        • Data
        • Code

        Which allows incredible things like:

        • See what Order execution type is in place
        • Why an order may have (not) triggered
        • And many more ...
        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors