Time compilation problem

 

Hi.


There is a strange compilation problem. I get a data loss on conversion warning.
I've never had such warnings before.
Is it the fault of the new version of the mt4 compiler?

Below is the code that is indicated with a warning.



The problem is with the word "offset".


How to fix it?

 
Artur Librot: There is a strange compilation problem. I get a data loss on conversion warning. I've never had such warnings before. Is it the fault of the new version of the mt4 compiler?

Below is the code that is indicated with a warning. The problem is with the word "offset". How to fix it?

It is not strange behaviour. TimeLocal() and TimeCurrent() return a "datetime" datatype, but you are assigning the difference to an "int", so you will have to typecast it.

offset = int( TimeLocal() - TimeCurrent() );
This is part of using the "strict" property in MQL4 which makes it behave more like MQL5, so always make sure to use "strict" and always fix your warnings. Don't ignore them.
Reason: