Errors, bugs, questions - page 1888

 
Alexandr Bryzgalov:

Why does the PositionGetInteger(POSITION_TYPE_SELL) function return a buy value (equal to 0) instead of an error value (equal to 0) in case of incorrect input parameters ?

An example of a number it could return in case of an error?
 
fxsaber:
An example of a number it could return in the event of an error?
-1
 
Alexandr Bryzgalov:

Why does PositionGetInteger() in case of incorrect input parameters returns buy( equal to 0) and not error(equal to 0) ?


Because it can return only TWO values - either POSITION_TYPE_BUY or POSITION_TYPE_SELL

ENUM_POSITION_TYPE

Identifier

Description

POSITION_TYPE_BUY

Buy

POSITION_TYPE_SELL

Sell


and no other values. And then it's like in movies "any coincidence of names is accidental"...

 
Alexandr Bryzgalov:
-1
And in case of an error PositionGetInteger(POSITION_MAGIC) ?
 
Vladimir Karputov:

Because it can return only TWO values - either POSITION_TYPE_BUY or POSITION_TYPE_SELL for

ENUM_POSITION_TYPE

Identifier

Description

POSITION_TYPE_BUY

Buy

POSITION_TYPE_SELL

Sell


and no other values. And then it's like in the movies "any coincidence of names is accidental"...


PositionGetInteger(POSITION_TIME); can already return more than 2 values

Amazing, isn't it?

 
fxsaber:
And in case of error PositionGetInteger(POSITION_MAGIC) ?
-1 only positive magics in MT5, I was indignant about only positive magics too )
 
Alexandr Bryzgalov:
-1 in MT5 majiks are only positive, about only positive majiks I also resented )
And the negative ones too.
 
fxsaber:
And negative.

In a warrant you can only send positive magicka values

struct MqlTradeRequest 
  { 
   ENUM_TRADE_REQUEST_ACTIONS    action;           // Тип выполняемого действия 
   ulong                         magic;            // Штамп эксперта (идентификатор magic number) 
   ulong                         order;            // Тикет ордера 
   string                        symbol;           // Имя торгового инструмента 
   double                        volume;           // Запрашиваемый объем сделки в лотах 
   double                        price;            // Цена  
   double                        stoplimit;        // Уровень StopLimit ордера 
   double                        sl;               // Уровень Stop Loss ордера 
   double                        tp;               // Уровень Take Profit ордера 
   ulong                         deviation;        // Максимально приемлемое отклонение от запрашиваемой цены 
   ENUM_ORDER_TYPE               type;             // Тип ордера 
   ENUM_ORDER_TYPE_FILLING       type_filling;     // Тип ордера по исполнению 
   ENUM_ORDER_TYPE_TIME          type_time;        // Тип ордера по времени действия 
   datetime                      expiration;       // Срок истечения ордера (для ордеров типа ORDER_TIME_SPECIFIED) 
   string                        comment;          // Комментарий к ордеру 
   ulong                         position;         // Тикет позиции 
   ulong                         position_by;      // Тикет встречной позиции 
  };
 

hehe, you can also get a negative one ))))

it's understandable, the MC had no choice )

 
Alexandr Bryzgalov:

You can only send a positive Majik value in a warrant

And negative.