How to convert typical practices in MQL4 to MQL5

i see that various mql4 indicators use a NewBar() function like this:

what is the best conversion of this practice to MQL5 ?

bool NewBar()

   static datetime LastTime=0;

   if(iTime(_Symbol,Period(),0)+time_offset!=LastTime)

     {

      LastTime=iTime(_Symbol,Period(),0)+time_offset;

      return (true);

     }

   else

      return (false);

  } 

Please re-edit your post and use the SRC button if you post code!!

I strongly suggest you to do some searches before creating new topics.

Your questions have been asked and answered numerous times.

This topic will be removed.