Using pre-built daily bars might work.

If not, then use the TimeFrame variable over granular BarPeriod(1-5min) to construct the "Daily" bars which would start and end as you require (skip overnights).
Setting TimeFrame to a negative number specifies how many bars back it covers and ends the frame.

Have you seen sample code for this is on the TimeFrame page in the manual?