Why do sometimes an order takes 2 bars to execute while most other times it only took one bar?
brozeki last edited by
I am having trouble while backtesting, sometimes an order is pending and next() is skipped causing some signal to be missed. Most of the times the orders executed on the next bar once signal is triggered before next() is called. Please advise.
2017-04-06T10:00:00, BUY CREATE, 2374.25, status:1 ref: 212 2017-04-06T10:00:00, BUY CREATE, 2374.25, status:2 ref: 212 2017-04-06T10:00:00, BUY EXECUTED, Price: 2375.50, Cost: 18600.00, Comm 5.00 ref: 212 2017-04-06T10:00:00, OPERATION PROFIT, GROSS -337.50, NET -342.50 2017-04-06T22:00:00, SELL CREATE 2370.50, status:1 ref: 213 2017-04-06T22:00:00, SELL CREATE 2370.50, status:2 ref: 213 **2017-04-06 22:00:00 PENDING ORDER. SKIP NEXT ref:213** 2017-04-07T02:00:00, SELL EXECUTED, Price: 2370.25, Cost: 18600.00, Comm 5.00 ref: 213
Which allows incredible things like:
- See what Order execution type is in place
- Why an order may have (not) triggered
- And many more ...