Hi again,
Ok I noticed that it doesn't work correctly, anyway can anyone try to explain what are we comparing using the second expression? We have 5 values using a logical operator and. From what I understand, all 5 values inside the ( ) have a value different from 0 so they are interpreted as true, so the expression will be first interpret as (true && true && true && true && true) > Teeth which results in 1 > Teeth, if the condition is true than the result is 1 else is 0, and this way it explains why some results appear at first glance to be correct.
Ok, this doesn't make much sense because it's bad programming, but I wanted to understand (even if wrong), the result given by both expressions. Thank you.
Cleon
Ok I noticed that it doesn't work correctly, anyway can anyone try to explain what are we comparing using the second expression? We have 5 values using a logical operator and. From what I understand, all 5 values inside the ( ) have a value different from 0 so they are interpreted as true, so the expression will be first interpret as (true && true && true && true && true) > Teeth which results in 1 > Teeth, if the condition is true than the result is 1 else is 0, and this way it explains why some results appear at first glance to be correct.
Ok, this doesn't make much sense because it's bad programming, but I wanted to understand (even if wrong), the result given by both expressions. Thank you.
Cleon
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
I'm curious about how MQL interprets logical expressions. If you check the code bellow you will see two "equivalent" expressions, but one is a normal expression, were I compare each element individually, on the second expression it looks like that MQL allows to compare all elements at once! Is this correct? In some tests I made both expressions return 1 or 0 when appropriate, so they look like to act the same way. If this type of logical expressions can safely be used than it will help to simplify some of my logical expressions. Anyone can confirm this?
Thank you. Regards,
Cleon