Force the order executed at specific price with certain size
-
I am using other program to simulate trade on stock market(using tick data). And I would like to force the backtrader to execute every order by the trade records(see graph).
For example, when the signal above 1, all-in with open price then sell certain size with open price * (1+rate).
I tried to use backtrader.order.limit to create order, but sometimes it will not execute with right price because of the intern logic of limit order.I wonder if there is any way to force the order executed at specific price with certain size, something like:
self.buy(price=self.datas[0].open[0], size=1000, exectype=backtrader.Order.Force)
will execute this order next bar without checking open price or any other price.
-
@vincentlee Backtrader is meant to simulate real life as much as possible. It's decisions will seek the best fill order based up on the available data.
-
@run-out see https://www.backtrader.com/blog/posts/2017-07-05-order-history/order-history/, Backtrader provide order-history function to evaluate external historical performance.