How to find the OHLC of a specific trading time range?

 
Is it possible for me to get the open, high, low, and close, for a specific trading timeframe of my choosing?

For instance, if I want to know what the OHLC is, for the 6 trading hours between 4am and 9am, is there a code that can do this?

I was thinking that I could load up the last day of 1hour bars, and from there, specify which bars I wanted to use as my trading range for my OHLC calculation.

Although I wasn't sure if I'd have to specify within the code to use only the current day's 1hr bars, and some of the previous day's 1hr bars.

Any suggestions?
 
Reason: