I'm quite new to MQL4 and haven't yet found a possibility to know if a certain bar is the first of the day (what can easily be done visually in the chart with "Show period separators"). So, what I'd like to have is some function like
bool IsFirstBar(int bar_index)
But what would the code for this function be?
Thanks in advance,
edit: Just looking for the time gap between two bars is not sufficient. There could be bars missing, or daylight saving time was switched during the weekend (this happens in the US two weeks earlier than in Germany for example, so US market is usually open 15:30 till 22:00 local time, but some weeks from 14:30 till 21:00). I hope you get the problem.
just wondering if noone knows an answer or if the topic just got lost ;-)
Not sure I fully understand your objective, but is the code from cameofx here of any use...
thanks for the hint, maybe iBarShift with exact = false will do the task. I'll give it a try.
if (TimeDay(Time) != TimeDay(Time)) ...