Sliding windows of time? e.g. 1 day bars from 2.37am to 2.37am? Possible?

 

Hi There

I have a need to read indicators and bars values based on a 4 hour window, but always updated to refer to a 4 hour bar ending at the latest tick. So instead of finding out the 4 hour low, high, etc only every 4 hours (12am, 4am, 8am, 12pm etc...), I need to read these values for the last 4 hour period from any arbitrary moment in time - like 2.37am. So I need a 4 hour bar ending at 2.37am, and historical indicators working also from those offset times.

How can I do this, without rewriting the bars and indicators code?

Thanks!

 

Find the datetime of current time - (4*60*60)

iBarShift to find the bar relating to that datetime on the M1 chart

Use iHigh and iHighest to find the high between bar0 and the shift on the M1 chart

iLow and iLowest to find the low

Reason: