I do not know the code in such detail, but would not expect that you can open a trade on the last bar. By default, trades open at the Open of the next bar. With no next bar, I don't think that a trade will open.

Also I think your problem is now clear: if the day is important for your trade, it's not good to enter trades exactly at midnight or just at the start of the weekend. The PC time is never this precise. If the server time is a microsecond slower than your PC time, you might get a tick with a 23:59:59.9999 time stamp, while your PC clock has already the next day at 00:00:00.0001. This is different to the backtest when tick time and PC time are always in sync. So better check the whole time and not only the day. Or set the bar offset so that your daily bars do not change exactly at midnight.

I will also mention this potential trap in the manual.