Download MetaTrader 5
To add comments, please log in or register
Find out how to use widgets at MQL5.community
PaulTheTrader
41
PaulTheTrader 2014.03.27 07:37 

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!

Keith Watford
Moderator
7953
Keith Watford 2014.03.27 08:34  

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

/
To add comments, please log in or register