Download MetaTrader 5

seems a bug ? iTime.

To add comments, please log in or register
murger
82
murger  
Hi guys,
After two days works finding what was wrong....
1)

in MT4 509 I've used :

 if(atd_FixTime[u]!=iTime(0,ati_TmFram[u],0))


in V600 : that make as result : 0 !!!

the good way for V600 is now:

if(atd_FixTime[u]!=iTime(Null,ati_TmFram[u],0)) 

if help.., perhaps a bug..??


D

edit for SRC correct :-)

Ex Ovo Omnia
3221
Ex Ovo Omnia  

I suppose it was NULL rather than Null.

The trouble is that NULL has two interpretations currently - the new one is acting as a pointer and the legacy one is acting as a substitute for zero. They are context dependent, so implementation may be tricky and may cause interference. There are a few more ambiguous keywords (e.g. static). I am trying to avoid the legacy ones.

Simon Gniadkowski
Moderator
18017
Simon Gniadkowski  
DanielTahiti:
Hi guys,
After two days works finding what was wrong....
1)
in MT4 509 I've used : if(atd_FixTime[u]!=iTime(0,ati_TmFram[u],0)) as usual,

Please use the SRC button to post code . . .

if(atd_FixTime[u] != iTime(  0  ,ati_TmFram[u], 0))

is wrong . . . the first parameter for iTime() is string symbol not an int . . . yes I know it works in 509 but it's not correct, the Documentation clearly says to use NULL . . . "NULL means the current symbol. "

Ex Ovo Omnia
3221
Ex Ovo Omnia  
RaptorUK:

Please use the SRC button to post code . . .

is wrong . . . the first parameter for iTime() is string symbol not an int . . . yes I know it works in 509 but it's not correct, the Documentation clearly says to use NULL . . . "NULL means the current symbol. "


... while some other place of the same help reads:

Constant

Description

Value





NULL

Zero for any types

0

Simon Gniadkowski
Moderator
18017
Simon Gniadkowski  
Ovo:


... while some other place of the same help reads:

NULL

Zero for any types

0

This is the definition for NULL . . .

Constant Value Description
NULL0Indicates empty state of the string.


The Documentation is pretty poor in many places . . . I just hope it doesn't get worse when it gets updated.

Ex Ovo Omnia
3221
Ex Ovo Omnia  
RaptorUK:

This is the definition for NULL . . .


The Documentation is pretty poor in many places . . . I just hope it doesn't get worse when it gets updated.


Yes, it is a smal change. Now the string NULL equals to "" (which is weird as well from my point of view), while former it was "0".
whroeder1
15019
whroeder1  
It wasn't "0" (a string) it was zero. That meant it was trying to pass a null pointer and that was interpreted at current pair. Now it's "" which is a zero length string. Three different things.
Ex Ovo Omnia
3221
Ex Ovo Omnia  
WHRoeder:
It wasn't "0" (a string) it was zero. That meant it was trying to pass a null pointer and that was interpreted at current pair. Now it's "" which is a zero length string. Three different things.


Well, no one said it was anything but zero. Try to assign a zero to a string in 509. The current pair was 0, "0", NULL - any of the three.

int start() {
        string a = NULL;
        Print(a);
}

The zero-lenght string is no Null either, therefore I said it was weird.

The third different thing I probably missed.

murger
82
murger  

Thanks all for Comments,

Do you know any similar exemple of this kind of change ? what mind about the statut of " static" ?

Ex Ovo Omnia
3221
Ex Ovo Omnia  
DanielTahiti:

Thanks all for Comments,

Do you know any similar exemple of this kind of change ? what mind about the statut of " static" ?





In the legacy code, the static keyword has been used for marking a variable permanent.

In the new code the static keyword is used for marking a class method or member (connected to no particular object), which is common in OOP.

So we have keywords with quite different interpretations, depending on the context they are used in.

To add comments, please log in or register