Order modification feature request
I know it's been requested already, but I'm just asking how it could be better achieved when backtesting with daily data.
Suppose you are a position/swing trader and you're long in the market so, to close the position, you may issue two orders: OCO orders, one stop loss and one take profit. Every day you'd go to your home broker and adjust the limit price on your stop loss order till you are either stopped or the price goes in your TP direction. You can do that here where I live.
To simulate that in BT, one would have to cancel the OCO orders and issue new ones with the recent limit price levels, but you lose one next() just for that as they would have to be accepted/submitted by the broker first, consuming one bar. I thought of adding a data1 with a lower resolution (minutes) and two rows for each day, the first just to cancel the orders and the next to submit new ones, all happening in the "same" data0 bar.
Is that more efficient than speeding the notifications?
but you lose one next() just for that as they would have to be accepted/submitted by the broker first, consuming one bar.
If you issue orders on the current  bar, than they will be active at the next [+1] bar. No bars are missed. Broker processes order in between current and next bar.
Yes, sure, but what I meant is that, to simulate an order update, they would have to be cancelled and new ones issued between current  and next [+1], can you do that with only daily data0?
@exu I did it some time ago, worked as expected.
To simulate that in BT, one would have to cancel the OCO orders and issue new ones with the recent limit price levels
Which effectively is what happens in the market. You make a change and your order goes to the back of the queue (as if it had been cancelled and then re-issued. If brokers didn't do that, they would be giving you an unfair advantage)
can you do that with only daily data0?
The timeframe is not relevant and is not looked into.
thanks guys, I'll try and implement just that...