Help requested on changes to Time[] after build 574.

 

Even though I have been writing code in mql4 for many years, I will have to confess that I am stumped on some of these new changes since build 509.

I have been using a "string name" + Time[index] to name objects on my charts. However, instead of Time[index] giving the number of seconds,

it gives the time in a text. I need the number of seconds like in build 509. Any help would be appreciated greatly.

 
int time = Time[index];
 
I tried that and got the following warning; "possible loss of data due to type conversion".
 
i tried it in both versions (B509 & B604) & gives me the same result (i dont c any loss of data)
 
I don't see any loss of data either. I just want to write it so that I have no warnings.
 
long a = Time[index]; //or ulong
 

int

The size of the int type is 4 bytes (32 bits). The minimal value is -2 147 483 648, the maximal one is 2 147 483 647.

so only in 2038 it will lose data

 

I'm not yet familiar with long or ulong. These are new to me.

 
bushTrader:

I'm not yet familiar with long or ulong. These are new to me.


long

The size of the long type is 8 bytes (64 bits). The minimum value is -9 223 372 036 854 775 808, the maximum value is 9 223 372 036 854 775 807.

ulong

The ulong type also occupies 8 bytes and can store values from 0 to 18 446 744 073 709 551 615.



whatever, this is the solution, (no warnings no errors)

 
Many thanks, your right, it works, though I'm not sure why yet. I'll study the MQL4 Reference some more.
 
bushTrader:
Many thanks, your right, it works, though I'm not sure why yet. I'll study the MQL4 Reference some more.


Do it properly, use the correct variable type . . .

datetime a = Time[index]; 
Reason: