I wanted to see if there is a way to have trade entry and exit (whether stop loss or take profit) processed on the same bar.
- I am using bracket BUY order with stop entry at 300, take profit at 400 and stop loss at 250
- previous bar closed at 280
- next bar has OHLC as following (280, 410, 240, 320)
Despite the fact that in realtime trading, clearly after entry order was executed, either stop or take profit would be hit in same bar (which one depends on whether high comes first or low comes first after entry) - when I am backtesting in backtrader, I get only entry order executed on this bar.
I am assuming that reason for that is that broker "doesn't know" whether High came firs tor Low. Is there a way to set a broker in a way that it makes an assumption (e.g. TradingView Pine Script assumes that price goes first to the end that is "closer" to the open - e.g. if high - open < open - low, it will go to high)? Is there such broker emulator in backtrader?
If not - is there a way to simulate that myself ? What would be the best way to go about it?
Thank you for help in advance!