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

Broker to execute the order with the closing price and not with the average price



  • Current situation: the order is issued in the "next" method and then before the start of the next candle, the method "notify_order" will check if there's an order request pending and execute them at the average price.

    What I expect: I would like that the order is executed with the closing price of the candle that I use to issue the order.

    is it possible to do it with backtrader?



  • Search cheat-on-close in the forum and documentation.



  • I've already tried it, however this will take the open price of the next candle. And I want to take the closing price of the current candle (the one of when I released the order). The behaviour expected is: release the order and make the broker action the order right away.



  • cheat-on-close forces bt to execute orders on the close of the current bar. Order notifications come on the next bar.


Log in to reply
 

});