The sample and the order validity inputs got out of sync (yes, code evolves and not all samples are re-run each and every time)
Fixing it in the sample is rather simple, but I will also add extra input check in the order.
In the sample to support your scenario. Change at line 104:
valid = self.data.datetime.date(0) + \ datetime.timedelta(days=self.p.valid)
valid = self.data.datetime.datetime(0) + \ datetime.timedelta(days=self.p.valid) valid = valid.replace(hour=0, minute=0, second=0)
Indeed, the data contains only trading data. But the bars between a
Friday and a
Monday are 3 days apart. If you tell the platform to expire after
24 hours, any order issued on a
Friday or right before a bank holiday, will always expire before being considered.