For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Placing order to broker from notify_order() causing 1 candle lag

  • 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().


    1. _load(self): - Returns 1 min candle at 9:30
    2. next(self) - Strategy creates Buy signal for 9:30 candle.
    3. 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.

Log in to reply