this is correct, or not???????
or not??????
I think that you have to add brackets to recognise combination conditions
if( (modebid>1261.00 && modeask<1262.00 ) || (modebid>1271.00 && modeask<1272.00) || (modebid>1241.00 && modeask<1242.00)
|| (modebid>1231.00 && modeask<1232.00) )
GumRai:
You don't have to, the precedence rules will govern what happens first and if it coincides with what is desired then it's OK . . . but in the new version of MT4 the precedence rules are changing . . . so it is of course good practice to make things unambiguous by using braces/brackets ( )
I think that you have to add brackets to recognise combination conditions
RaptorUK:
You don't have to, the precedence rules will govern what happens first and if it coincides with what is desired then it's OK . . . but in the new version of MT4 the precedence rules are changing . . . so it is of course good practice to make things unambiguous by using braces/brackets ( )
You don't have to, the precedence rules will govern what happens first and if it coincides with what is desired then it's OK . . . but in the new version of MT4 the precedence rules are changing . . . so it is of course good practice to make things unambiguous by using braces/brackets ( )
To be honest, I wasn't sure, but it's the way I do it and as you say is good practice.
As is putting spaces either side of && and || to make it easier to read.
ok,thank you
What does it mean? if( (modebid>1261.00&&modeask<1262.00) || (modebid>1271.00&&modeask<1272.00) ||... (1261 - 1262) or (1271 - 1272) ... if(modebid>1261.00&& (modeask<1262.00||modebid>1271.00) && ... above 1261 but not [1262 - 1271] ...
Always parenthesis when mixing ands and ors, so YOU can understand what you're writing. if( (modebid>1261.00&&modeask<1262.00)|| (modebid>1271.00&&modeask<1272.00)||...
Make your code readable. Books aren't two foot wide, one column with no spaces between words for a reason. Neither should your code. if( (modebid > 1261.00 && modeask < 1262.00) || (modebid > 1271.00 && modeask < 1272.00) || ...
Using bools with good names makes the code self documenting, and if it doesn't read right, it's not coded right. bool is1261 = modebid > 1261.00 && modeask < 1262.00, is1271 = modebid > 1271.00 && modeask < 1272.00, : if( is1261 || is1271 || ... )
double modebid = MarketInfo(Symbol(),MODE_BID); double modeask = MarketInfo(Symbol(),MODE_ASK);
Why are you using function calls for the current symbol when you can just use the predefined variables Bid and Ask?

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