- Meta Editor not updated.
- New MetaTrader 4 build 1160
- Rogue Trader
Build 600+
The bool type is intended to store the logical values of true or false, numeric representation of them is 1 or 0, respectively.
Looks like it was that way for old MQL4 too, you might have never had the compiler warning but I suspect the code blocks would never have executed. A point for build 610+ :)
Hi, I have an EA that worked just fine with the meta trader 4 platform.. however I just recently updated to build 610 and now the EA does not work... I compiled it with the new Meta Editor and am now getting two warnings .. Both are the following Expression is always false, Not sure why this would stop the EA from entering trades, but the EA will not enter any trades what so ever ... the problem hi-lighted below is the code -> if(Deleted < 0) and also in another function -> if(Closed < 0) .... always returns false, any suggestions as to why Build 610 sees this differently ? Thanks
A bool type can not be less than 0; rather, it is either true or false (or 1 or 0, respectively).
Consider changing the IF statements to:
if (!Closed) { ... } if (!Deleted) { ... }
The IF statements would then be executed when Closed is false and when Deleted is false.
A bool type can not be less than 0; rather, it is either true or false (or 1 or 0, respectively).
Consider changing the IF statements to:
The IF statements would then be executed when Closed is false and when Deleted is false.
Not strictly true.
A bool can be any number but will only return false if it is 0. Any other number will return true
bool a =10 * 10; bool b =10 * 0-10; Alert( a); Alert( b);
Not strictly true.
A bool can be any number but will only return false if it is 0. Any other number will return true
A matter of semantics I suspect.
bool a= 101; int n = a + 1; Alert(n); // = 2
A matter of semantics I suspect.
Good point, argument can be any number, but result will always be 1 or 0.
My apologies Thirteen
This is strictly true. A bool can be assigned any number, but the resulting bool will ONLY be 0 or 1.
Did you not see my post, just before yours?
ydrol had already pointed out about the resulting bool value and I agreed and apologised to Thirteen
GumRai:
My apologies Thirteen
No apologies necessary. :)
The documentation states that: a "zero value will be interpreted as false, and all other values - as true." Can anyone explain to me why that is? Why isn't it the opposite--a value of 1 will be interpreted as true, and all other values will be interpreted as false? It seems to me (and I certainly can be wrong) that the natural state should be false until it becomes true, rather than true until it becomes false. (Or just maybe I need another coffee with more caffeine!! LOL)
Thanks for all your help.... I did change the code to if(!Deleted) and if(!Closed) and recompiled it... This change solved the two warnings I was getting, so now it compiles with no Errors and no Warning, and it loads fine onto the 610 build platform and it allows me to do my manual inputs..... BUT it still does not enter any trades .... the Mystery thickens..... It worked just fine on Build 509 and the Meta Editor for 509 .... I am just learning to program so, I am totaly lost here... I do not have a clue where to look in the code to possibly find why it will not open trades.... THE NEW BUILD SUCKS...... LOL They still obviously have bugs !!!
Any Help would be appreciated.... And thanks for the help you have already given me.. :-)
Thanks for all your help.... I did change the code to if(!Deleted) and if(!Closed) and recompiled it... This change solved the two warnings I was getting, so now it compiles with no Errors and no Warning, and it loads fine onto the 610 build platform and it allows me to do my manual inputs..... BUT it still does not enter any trades .... the Mystery thickens..... It worked just fine on Build 509 and the Meta Editor for 509 .... I am just learning to program so, I am totaly lost here... I do not have a clue where to look in the code to possibly find why it will not open trades.... THE NEW BUILD SUCKS...... LOL They still obviously have bugs !!!
Any Help would be appreciated.... And thanks for the help you have already given me.. :-)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use