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
Example from CTrade trade class. First it is checked for'SYMBOL_FILLING_FOK', then for'SYMBOL_FILLING_IOC'.
The check is performed by usingthe 'AND bitwise operation'.
Bitwise AND operation
The bitwise AND operation of the binary representations x and y. The value of the expression contains 1 (TRUE) in all bits where both x and y contain non-zero; and 0 (FALSE) in all other bits.
Example:
More about bitwise operations.
Can't there be two at the same time after all? What should the function return for there to be two at the same time?
Can't there be two at the same time after all? What should the function return for there to be two at the same time?
Example of checks for two characters from the MetaQuotes-Demo server:
See the specifications (fill-in) for these symbols:
and here is a more common variant: when all fills are available for a symbol
and specification
It could be 2, then the function will return 3. BUT¡¡¡¡¡ This is an atypical situation. Given that there are only 3 options, it could be 1, 2 or the sum of 1+2. It is the sum, not the third option. So checking with a bitwise operation can only answer the question: Can this or that fill policy be applied.
I still don't understand how one variable can return two members. And if it returns one term as 3, then bitwise operations won't work. I decided to just choose EXECUTION_INSTANT mode and I will always have a FOK policy .
To understand this you need to understand what flags are.
Each next value of a flag is the value of the previous one multiplied by 2. I.e. 1, 2, 4, 8, 16, 32......... So if the value is 33 it means that this value contains only 1 and 32. Similarly if the value is 18 it can only be composed of 16 and 2. And the value 3 can only be composed of 1 and 2.
So bitwise operations are just checking if the checked value is present in the sum of flags. If you check if an arbitrary number is included in 18 you get false, except for checking values 2 and 16.
To understand this you need to understand what flags are.
Each next value of a flag is the value of the previous one multiplied by 2. I.e. 1, 2, 4, 8, 16, 32......... So if the value is 33 it means that this value contains only 1 and 32. Similarly if the value is 18 it can only be composed of 16 and 2. And the value 3 can only be composed of 1 and 2.
So bitwise operations are just checking if the checked value is present in the sum of flags. If you check if an arbitrary number is included in 18 you'll get false except for checking values 2 and 16.
Yes, I understand how to work with binary digits.
From this code, for example, the function returns 3 .
(11&1)==1 ; 11==01 no, that's false, it didn't work.
I was just writing this and thought maybe I misunderstood the operations.
& it means I convert decimal values to binary and do a bitwise conjunction.
== true when the first term is equal to the second term. Is this correct?