Questions from a "dummy" - page 141

 
Yedelkin:

The problem seems to be something else.

The value "3" does not return in any way :) After all, the enumerations are numbered from zero.

Use EnumToString function to output enumeration values
 
In MQL5 values of periods of type PERIOD_M1 ... PERIOD_MN1 are values of the integer type? I want to compare them using the switch operator. E.g. if the expression is correct:
input ENUM_TIMEFRAMES Period_code=PERIOD_H4;
int result; string big;

switch (Period_code)
{
case PERIOD_H4: { result=1; big="data 1"; break; }
case PERIOD_D1: { result=2; big="data 2"; break; }
}
 

Rosh:

Yedelkin:

The problem seems to be elsewhere.

Value "3" does not return in any way :) Because enumerations are numbered from zero.

Use the EnumToString function to output enumeration values

The strange thing is that this suggestion didn't come up earlier, when the author of the local topic was stating his results as"Returns 3". OK, let's go down the unbeaten path.

T-G:

Returns 3 - that is, SYMBOL_TRADE_EXECUTION_MARKET.

Following Roche's advice we write a simple check (using EnumToString):

//+------------------------------------------------------------------+
//|                                                       class5.mq5 |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(3))=",EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(3)));
  }
//+------------------------------------------------------------------+

And what do we see? - What we see is that number "3" does not correspond to SYMBOL_TRADE_EXECUTION_MARKET. So we return to https://www.mql5.com/ru/forum/3775/page143#comment_192116

 
Paladin80:
In MQL5, values of periods of type PERIOD_M1 ... PERIOD_MN1 are values of the integer type? I want to compare them using the switch operator. For example, is the expression:
ENUM_TIMEFRAMES is an enum(MQL5 Reference / Status Check / Period). Enumerations is an integer data type(MQL5 Reference / Language Basics / Data Types / Integer Types / Enumerations ).
 
Hello, could you tell me how to check if a Buy or Sell was closed today for a particular instrument?
 
T-G:
Hello, can you tell me how to check if Buy and Sell for a certain instrument were closed today?

If no one will post the ready code, then try to write it yourself. Probably the easiest approach is as follows: select the history of deals for a particular day(HistorySelect) and try to search the history for deals that refer to the selected symbol

DEAL_SYMBOL

Name of the symbol for which the deal has been made

string

then check

DEAL_TIME

Deal time

datetime

и

DEAL_ENTRY_OUT

Market exit

If there were several closing positions for one symbol during the day, you can also get the time of each deal and process it according to the author's algorithm.

 
Yedelkin:

The strange thing is that this suggestion was not made earlier, when the author of the local topic was stating his results as"Returns 3". OK, let's go down the unbeaten path.

Following Roche's advice, we write a simple check (using EnumToString):

//+------------------------------------------------------------------+
//|                                                       class5.mq5 |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(3))=",EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(3)));
  }
//+------------------------------------------------------------------+

And what do we see? - What we see is that number "3" does not correspond to SYMBOL_TRADE_EXECUTION_MARKET in any way. So we go back to https://www.mql5.com/ru/forum/3775/page143#comment_192116.

How about this? :)

Print("SYMBOL_TRADE_EXECUTION_MARKET=",SYMBOL_TRADE_EXECUTION_MARKET);
Print("EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(2))=",EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(2)));
T-G:

Returns 3 - that is SYMBOL_TRADE_EXECUTION_MARKET

3 is SYMBOL_TRADE_EXECUTION_EXCHANGE logically.

You'd better tell us what and where we are trying to trade... :)

 
Interesting:

How about this? :)

Print("SYMBOL_TRADE_EXECUTION_MARKET=",SYMBOL_TRADE_EXECUTION_MARKET);
Print("EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(2))=",EnumToString(ENUM_SYMBOL_TRADE_EXECUTION(2)));

Well, it's the same thing. Only from another angle. Number "3" and value of enumeration"SYMBOL_TRADE_EXECUTION_MARKET" are not related at all.Except maybe by the precedence relation.

Interesting:

3 is SYMBOL_TRADE_EXECUTION_EXCHANGE logically.

It's not that "logically", but that's just how it is at the moment.

 
Yedelkin:

Well, it's the same thing. Only from a different angle. The number "3" and value of the"SYMBOL_TRADE_EXECUTION_MARKET" enumerationare not related in any way.The only difference is in the precedence relation.

It's not that "logically", but that's just how it is at the moment.

Well, it makes sense that we have exchange execution(SYMBOL_TRADE_EXECUTION_EXCHANGE) and consequently no TP/SL
 
Interesting:
So it makes sense, we have exchange execution(SYMBOL_TRADE_EXECUTION_EXCHANGE) and therefore no TP/SL
I can't find my way around. Where in the Reference Manual does it say that when there is an exchange execution, the request should not contain TP/SL?
Reason: