Download MetaTrader 5

How and/or condition work different between old build and new build

To add comments, please log in or register
Mohammad Ali
19939
Mohammad Ali 2014.05.28 09:47 

Hello guys

i have a indicator if condition like that

           if (Ld_20 < Ld_128 && Ld_20 < Ld_136 && Ld_12 > Ld_128 && Ld_12 > Ld_136 && Ld_128 < Ld_136 || ((Ld_20 > Ld_128 && Ld_20 > Ld_136 && Ld_12 < Ld_128 && Ld_12 < Ld_136 &&
                           Ld_128 > Ld_136) == FALSE)) continue;

 

 Now build show error "check operator precedence for possible error; use parentheses to clarify precedence..."

 

I have question how new build work. How can i modify above code , will work in new build like old build.

can i write this way :

           if (  (Ld_20 < Ld_128 && Ld_20 < Ld_136 && Ld_12 > Ld_128 && Ld_12 > Ld_136 && Ld_128 < Ld_136) ||  ((Ld_20 > Ld_128 && Ld_20 > Ld_136 && Ld_12 < Ld_128 && Ld_12 < Ld_136 &&
                           Ld_128 > Ld_136) == FALSE)   ) continue;

 or this way :

 

           if (Ld_20 < Ld_128 && Ld_20 < Ld_136 && Ld_12 > Ld_128 && Ld_12 > Ld_136 &&  ((Ld_128 < Ld_136) || ((Ld_20 > Ld_128 && Ld_20 > Ld_136 && Ld_12 < Ld_128 && Ld_12 < Ld_136 &&
                           Ld_128 > Ld_136) == FALSE) ) ) continue;
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.05.28 10:10  
Doesn't matter how you write it as long as you explicitly tell the ea to check what and then what and then what, in orders.
Amir Yacoby
1195
Amir Yacoby 2014.05.28 11:37  

like second option but you have 1 extra set of () to remove

           if (  (Ld_20 < Ld_128 && Ld_20 < Ld_136 && Ld_12 > Ld_128 && Ld_12 > Ld_136 && Ld_128 < Ld_136) ||  (Ld_20 > Ld_128 && Ld_20 > Ld_136 && Ld_12 < Ld_128 && Ld_12 < Ld_136 &&
                           Ld_128 > Ld_136) == FALSE)  continue;

didn't check compilation though..

Keith Watford
Moderator
9639
Keith Watford 2014.05.28 12:24  

It is probably not an error, just a warning.

Can't say any more because the code is so wide and I can't be bothered to scroll back and forth 

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.05.28 12:44  
if (  (Ld_20 < Ld_128 && Ld_20 < Ld_136 && Ld_12 > Ld_128 && Ld_12 > Ld_136 && Ld_128 < Ld_136) ||  
(Ld_20 > Ld_128 && Ld_20 > Ld_136 && Ld_12 < Ld_128 && Ld_12 < Ld_136 && Ld_128 > Ld_136) == FALSE)  continue;
widens narrowed ... lol ... XD
whroeder1
14739
whroeder1 2014.05.28 17:13  
Code like that means decompiled code.Ask the owner of the source code to give it to you.

Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317

If you post decompiled code again, you will likely be banned and Mt4 doesn't allow compilation of decompiled code any more.

Alain Verleyen
Moderator
31085
Alain Verleyen 2014.05.28 19:23  
capilta:

Hello guys

i have a indicator if condition like that

 

 Now build show error "check operator precedence for possible error; use parentheses to clarify precedence..."

 

I have question how new build work. How can i modify above code , will work in new build like old build.

can i write this way :

 or this way :

 

 

Please follow WHRoder advice above and don't post decompiled code again. Thank you.
To add comments, please log in or register