This was fine before new mt4 builds but is throwing up "cannot convert type string to bool" when I try to compile now, any ideas?
if((bool)response.getAttribute("error"))
- New MetaTrader 4 Platform build 1030
- 'Name of EA' is not expert and cannot be executed on MT4 build 600.
- Expert Advisors: FAT PANEL
honest_knave: Check point #5 here
That is in reference to MT5, but the OP is reporting the issue on MT4. If that is indeed the case (as I have not tested it myself), then development on MT4 is not just bug fixes, but still has some active development taking place. However, this may not be intentional, but just a side effect of internally shared or common code between the versions.
Fernando Carreiro:
That is in reference to MT5, but the OP is reporting the issue on MT4. If that is indeed the case (as I have not tested it myself), then development on MT4 is not just bug fixes, but still has some active developed taking place. However, this may not be intentional, but just a side effect of internally shared or common code between the versions.
Yes, it is the same behaviour in MQL4. I surmize this is because it is a common compiler.
That is in reference to MT5, but the OP is reporting the issue on MT4. If that is indeed the case (as I have not tested it myself), then development on MT4 is not just bug fixes, but still has some active developed taking place. However, this may not be intentional, but just a side effect of internally shared or common code between the versions.
honest_knave: Yes, it is the same behaviour in MQL4. I surmize this is because it is a common compiler.
True, I forgot that the Compiler/Editor is common. Guess I am needed some "zzz's" and not thinking straight!
Fernando Carreiro:
True, I forgot that the Compiler/Editor is common. Guess I am needed some "zzz's" and not thinking straight!
I know that feeling! True, I forgot that the Compiler/Editor is common. Guess I am needed some "zzz's" and not thinking straight!

honest_knave:
Yes, it is the same behaviour in MQL4. I surmize this is because it is a common compiler.
I doubt that as it is my experience that mql5.-compiler cannot compile e.g. DoubleToStr() /* the old mt4 function */ while the mql4 compiler already compiles both functions DoubleToStr() and DoubleToString().
Yes, it is the same behaviour in MQL4. I surmize this is because it is a common compiler.
Carl Schreiber:
I doubt that as it is my experience that mql5.-compiler cannot compile e.g. DoubleToStr() /* the old mt4 function */ while the mql4 compiler already compiles both functions DoubleToStr() and DoubleToString().
I doubt that as it is my experience that mql5.-compiler cannot compile e.g. DoubleToStr() /* the old mt4 function */ while the mql4 compiler already compiles both functions DoubleToStr() and DoubleToString().
Now there is only one version of MetaEditor, I'm surmizing (again) that MetaQuotes aren't going to bother to make the compiler behave differently between MQL4 and MQL5 with these sort of changes. They certainly haven't with this "feature" i.e. disabling the support for casting string types to bools.
Legacy items like DoubleToStr() and TimeToStr() had to be explicitly catered for in the past, but why would they bother differentiating now?
Carl Schreiber: I doubt that as it is my experience that mql5.-compiler cannot compile e.g. DoubleToStr() /* the old mt4 function */ while the mql4 compiler already compiles both functions DoubleToStr() and DoubleToString().
It is a fact that it is the same compiler, not an opinion. The same compiler can compile both MQL4 and MQL5 code, but obviously it has two modes of operation, but that does not mean that it does not share a common base code.It would not make any sense for them to keep two separate "base" code sections for each one, if they use a single compiler. If they had, they would have done separate compilers.
gangsta1:
This was fine before new mt4 builds but is throwing up "cannot convert type string to bool" when I try to compile now, any ideas?
This was fine before new mt4 builds but is throwing up "cannot convert type string to bool" when I try to compile now, any ideas?
if((bool)response.getAttribute("error"))
if(StringCompare(response.getAttribute("error"),"true",false)==0)

Alain Verleyen:
Thank you very much Alain! Solved the error perfectly. :-)
if(StringCompare(response.getAttribute("error"),"true",false)==0)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register