how to convert typical practices in MQL4 to MQL5

 

Hello, 

 

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.
 
Alain Verleyen:

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.
ok housekeeper, there is no point in asking nothing here anyway...
 
pay a little for a platform with some kind of support is ending up much cheaper than these free MT5 platforms...
 
madruga trader:
ok housekeeper, there is no point in asking nothing here anyway...

You should be ashamed to say such things, when you are not even able to do a simple search.

Why are you thinking I (or anyone) have to do that for you ?

 
madruga trader: ok housekeeper, there is no point in asking nothing here anyway... pay a little for a platform with some kind of support is ending up much cheaper than these free MT5 platforms...

English:

If you have not noticed this is an "English" forum. If you have difficulty with the language, please use the "Portuguese" forum. I am sure you will be more comfortable communicating in your own mother tongue.

The posters gave you the answer and offered the "support" you requested. It is not their fault you did not understand it, due to the language barrier.

However, please remember, either way, you will always need to put in the effort and do some research on your own, or alternatively, hire someone to teach you or code it for you.

Português:

Caso não tenha notado, este fórum é em "Inglês". Se tiver dificuldades com o idioma, utilize o fórum "Português". Tenho a certeza de que será mais confortável para si, comunicando na sua própria língua materna.

Os utilizadores deram-lhe a resposta e o "apoio" que solicitou. Não é culpa deles que voçê não tenha entendido, devido à barreira linguística.

No entanto, lembre-se, que de qualquer forma, precisará sempre de esforçar-se um pouco e fazer alguma pesquisa por conta própria, ou alternativamente, contratar alguém para ensiná-lo ou codificar por si.