The market hours are not rounded, but evaluated at the end of any bar. That's why you got the 17:00 close price. I don't know the reason of 16:30 prices though - maybe that asset simply has no 17:00 prices. For closing a 17:00 candle with the 16:57 price, use a tick function and set the NOPRICE flag at the market end time. I don't want Zorro to do that automatically because it would cause incorrect candles behind the user's back.