returns the execution policy. - page 3

 
Ivan_Invanov:

Yes, I understand how to work with binary digits.

From this code it comes out, e.g. the function returned 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?

This is the stuff I don't understand, I'm self-taught. I just know how to check and what I can get. Your example (11&1)==1 will result in true since 11 can only be made up of flags 1+2+8 hence 1 is included in the set.

Check what will be returned

return(1|2|8);
 
Alexey Viktorov:
This is the stuff I don't understand, I'm self-taught. I just know how to check and what I can get. Your example (11&1)==1 will result in true as 11 can only be made up of flags 1+2+8 hence 1 is included in the set.

Check what will be returned

This is what I wrote in binary, I forgot to specify. I substituted the values into the code I wrote if the function returned 3 and compared it to FOK. This is how binary is written. (0b11 & 0b1)==0b1 ; the result in brackets 0b11 has the expression 0b11==0b1 ; but it turns out false, in my opinion. It must be true for everything to work. Well, since this sample is in the help, it is true. I must have misunderstood something. I have now looked at the C help, and the mql one before that. It seems to be the same. I apologize if I am asking very dumb questions and thank you all for the answers.
 
The mql help says that the value true is any non-zero value, so that must be the answer. And then equality, and in C equality. It turns out that it's not equality, but if the compared terms are greater than zero, then the value is true. I guess so. It's written quite unclear. It's about the == operator.
Документация по MQL5: Основы языка / Типы данных / Целые типы / Тип bool
Документация по MQL5: Основы языка / Типы данных / Целые типы / Тип bool
  • www.mql5.com
Внутреннее представление – целое число размером 1 байт. Необходимо отметить, что в логических выражениях допустимо использовать вместо типа bool другие целые или...
 

A bitwise operation, this is a P O B I T O R T operation. It works with bits. For example, 1 is 00000001. 2 is 00000010. A flag can only be 1, 2, 4, 8, etc. In short, one bit is busy.

And a set of flags can have any bits occupied, for example 00000101. This set includes flag 00000001 and 00000100. And to find out if some flag is included in the set of flags, you have to do a bitwise "and" of the flag and the set, if it leaves a flag, it means it is in the set:

(00000101& 00000100) == 00000100 - true. This means that there is a flag 00000101 in the set 00000101.

 
Dmitry Fedoseev:

A bitwise operation, this is a P O B I T O R T operation. It works with bits. For example, 1 is 00000001. 2 is 00000010. A flag can only be 1, 2, 4, 8, etc. In short, one bit is busy.

And a set of flags can have any bits occupied, for example 00000101. This set includes flag 00000001 and 00000100. And to find out whether some flag is included in the set of flags, you have to do a bitwise "and" of the flag and the set, if after that a flag remains, it means it is in the set:

(00000101& 00000100) == 00000100 - true. This means that there is a flag 00000101 in the set 00000101.

Is it true that (positive term 1 == positive term 2) but positive term 1 is not equal to positive term 2? It turns out so, because the help says that truth is any non-zero value, and then the code works.
 
Ivan_Invanov:
Is it true that (positive term 1 == positive term 2) but positive term 1 is not equal to positive term 2? It turns out so, because the help says that truth is any non-zero value, and then the code works.
What confuses me is that the word equality is written next.
 
Where is the reference? Specifically where and what?
 
Dmitry Fedoseev:
In what place of the reference? Exactly where and what?

This seems to me to be a contradiction. It is true not if a equals b, but if a and b are different from zero. Well, it's not a contradiction, it's not clearly written. I think I've got it, thank you.

Files:
1111.jpg  29 kb
 
ENUM_SYMBOL_TRADE_EXECUTION It doesn't say what type it is, and the headers in help are mixed up (it seemed to be written for string, and then without mentioning started talking about integers). I tried all three options, but each time compiler error. What is wrong?
long execution = (long) SymbolInfoInteger(_Symbol, ENUM_SYMBOL_TRADE_EXECUTION);
string execution = (string) SymbolInfoString(_Symbol, ENUM_SYMBOL_TRADE_EXECUTION);
double execution = (double) SymbolInfoDouble(_Symbol, ENUM_SYMBOL_TRADE_EXECUTION);
 
Ivan_Invanov:
ENUM_SYMBOL_TRADE_EXECUTION It doesn't say what type it has, and the headers in help are mixed up (it seemed to be written for string, and then without mentioning started talking about integers) . I tried all three options, but each time compiler error. What is wrong?

You have to do it this way:

//--- Check trade execution mode
  ENUM_SYMBOL_TRADE_EXECUTION market_info = ENUM_SYMBOL_TRADE_EXECUTION(SymbolInfoInteger(Symbol(), SYMBOL_TRADE_EXEMODE));
    
  if((market_info & SYMBOL_TRADE_EXECUTION_EXCHANGE) != SYMBOL_TRADE_EXECUTION_EXCHANGE)
  {
    MessageBox("Символ " + Symbol() + " не поддерживает TRADE EXECUTION EXCHANGE режим!", "Ошибка", MB_OK | MB_ICONHAND);
    return(false);
  }
Reason: