For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Trade on next bar at close
-
I know that by default trades are executed on the next bar at the open price of it, and you can use cheat-on-close to trade on the current bar at the close, but what I was wondering if there is a way to trade on the next bar, but instead of the open, on the close.
its looks like I could re-write the _try_exec_market function in the Broker class, but wondering if there is an easier way?
My hack to do this has been to create a datas where the open=close, so that the open price is the close price, but that seems like a weird workaround.
-
@adamb032 i found the solution to use exectype=Order.Close in the self.buy/sell parameters.