For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Open position but no resting order

  • Hi,

    I am new to backtrader and I have been stuck on a problem for a while.

    In my strategy, I am placing buy and sell orders simultaneously. At each cycle, my function next is designed to first check whether a position is open or closed. If open, I would like to look at details of the order that is still resting.

    I thought that if a position is open, it is because one of my orders was executed and the other one is still to be. However, my code breaks because although it finds an open position, it does not find any resting order.

    Any ideas of what might be going on ? Perhaps this has to do with my little understanding of the process, but I could not yet find a good walk through.

    Thank you very much in advance.


  • @Andre-Frade said in Open position but no resting order:

    Any ideas of what might be going on ?

    • No resting order is issued
    • Resting order is executed before you search for it
    • The way you are looking for the resting order is incorrect

Log in to reply