New bar with iBar

 

Is there a way to detect new bar with iBar function? 

Common methods for this purpose use time functions.

iBars - Timeseries and Indicators Access - MQL4 Reference
iBars - Timeseries and Indicators Access - MQL4 Reference
  • docs.mql4.com
iBars - Timeseries and Indicators Access - MQL4 Reference
 
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum.) Always use time.
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
          New candle - MQL4 and MetaTrader 4 - MQL4 programming forum