In previous builds of metatrader 4 (builds 509 or earlier) you could write something like this :
and you would get a correct value. In new metatrader 4 you will always get 0 for such an expression. You must use
Yes, they have hard times with keywords, that have different interpretation in the old MQL4 and the MQL5 - like.
The NULL is now used either for an empty object reference (though the 'delete' command does not assign it automatically to the destroyed reference) and a substitute for a zero-length string "", while formerly it used to be a substitute for integer zero, which - casted to string - gave "0".
I have a custom of writing NULL always for a current symbol, some did not do so (it allowed them, and I can not blame them - it was shorter and easier to write it like that). This case was one EA I was revising that was not made by me. And it took me some time to understand why the EA did not work like in build 509 at all
Along with boolean expressions evaluation, some EAs are going to be hell to convert - and sometimes it will take a long time before it is made work as it should. All in all - right now I think that a lot of EAs will not work the same as before at all. Not going to be malicious to say that it was the intention, but it will take years to get reasonably confident in some things in this new metatrader 4 and that the results for some things working before start to look like in the old metatrader (for some, I am convinced that they will never work the same way as before)
Why it does not accept "" as an argument (only NULL)?
That is a probably a compiler bug that is then inherited by the executing function(s). Obviously the functions are working differently and that will cause a lot of undetectable errors in code - since there is no warning nor runtime error raised in cases like that
All in all, a coding environment that can not be called good (results are unreliable and inconsistent with a lack of error information it is like searching a needle in the hay stack)
Well, I do not know why. But you were correct, only NULL gave some value. So meaning of the NULL was even more mystical than I thought.
Unfortunately I have to agree with you. I keep doubting whether it was not better to have rather two programming options available concurrently. All the mess comes from unfortunate mixing of simple "script" and "object oriented language" syntaxes. They added the property strict to switch between those variants, but as it applies only partially, we have finally three MQL4 variants - old MQL4, new MQL4 without strict and MQL4 with strict. Not mentioned that none is easily convertible to/from MQL5.
They have messed up the whole thing so much that there is no chance that it will ever work correctly
One can not sit on 5 chairs (there is metatrader 5 too and the old metatrader 4 that is different than any of the new metatrader 4 combinations).
Read this on the MT4 forum.
I also noticed this. A lot of you traders reported that they can't start terminal.exe anymore from one day to another. Starting it makes it pop up for a second and then closes it again. I keep reading this over and over here. Re-installing it or installing it over won't help. The solution is in the config directory. Under some circumstances terminal.exe writes a null byte file called "version.ini" or something. This file has a lenght of 0 bytes. So if you run into this behavior again, then please DELETE this file. Terminal.exe will start normally again.
Thank you for the information
What I do not understand is why the hell they do not correct it if it is already known how it can be corrected? Or do they read what is told about this new metatrader 4 atrocity at all?
That is a simple case of tunel vision : metquote people see only good things they have done now in new metatrader 4. Not the bad things. Otherwise I would have to think that someone is doing all this (ruining a trading platform) on purpose