how to get Period separator's candle id ?

 

Is there any simpler way to get the candle id where a period has started?

screenshot



i know that there is a way around it by using the Bars() function and calculating the candles from current time to the time 00:01 for one day period  and then for weekly using the day of the week  filter, but trying to avoid it if possible , looking for something simpler then that , if there is any ........

not looking for the exact code , just some guidance .......


thanks 

 
Arad_1: Is there any simpler way to get the candle id where a period has started?
Depends on the chart period.
  1. Less than H4 it is the start of a new day.

    int iBOD = iBarShift(_Symbol,_Period, Date() );
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06

  2. H4 it is the start of the week.
  3. D1 it is the start of the month.
  4. W1 it is the start of the year.