Placing order to broker from notify_order() causing 1 candle lag
Tejas Pinge last edited by
We have created live DataFeed where _load() returns 1 min live candle.
This data is being used in the strategy's next(self).
The issue is if the signal is generated for a candle in next() then notify_order() is called after receiving next candle. This is causing 1 candle delay in live trading as we are placing order to broker from notify_order().
- _load(self): - Returns 1 min candle at 9:30
- next(self) - Strategy creates Buy signal for 9:30 candle.
- notify_order(self, order) - Places order after getting 9:31 candle.
Are we missing anything? Kindly guide.
Share the script please. It is not clear what do you try to achieve.
notify_order()is called than your orders are processing, but looks that you don't have them yet. So it should not be called at all.