Questions from Beginners MQL5 MT5 MetaTrader 5 - page 34

 
Yedelkin:
The time of price change is shown by GMT+3, I think. Whose server is this?
roboforex
 
dentraf:
roboforex
Probably even if you contact servicedesk, they will send you to the broker's support team. Why don't you talk to your broker straight away?
 

Yedelkin:
Наверное, даже если обратиться в сервисдеск, они отправят в службу техподдержки брокера. Может, сразу с брокером пообщаетесь

Probably just need to change broker))))))))))

 

Good evening! I have set myself the task of identifying for the current position a list of trades from which it is made up. Like - 1. 1 lot buy, 2. 4 lots buy, 3. 1 lot sell and so on. I just don't know how to approach the problem. I spent three hours looking through the help.

So far, I've been writing this to try it out.

/////////////////////////////////////////////////////////////////////// 
 
 
  PositionSelect(   Symbol() );   
  
  long PositionID =PositionGetInteger(POSITION_IDENTIFIER);//Идентификатор позиции - это уникальное число, которое присваивается каждой вновь открытой позиции и не изменяется в течение всей ее жизни. Переворот позиции не изменяет идентификатора позиции.
  
  
   HistorySelect(
     TimeCurrent()-(60*60*24*7*4) ,    // с даты
     TimeCurrent()       // по дату
   );
   
    for(int i=0; HistoryDealsTotal()>i; i++ ) {
       ulong TicetSdelki;
       TicetSdelki=
       HistoryDealGetTicket(
       i        // номер сделки
       );
       
     long  HistoryID =  HistoryDealGetInteger(
         TicetSdelki               ,     // тикет
   DEAL_POSITION_ID          // идентификатор свойства
   );                          //Идентификатор позиции, в открытии, изменении или закрытии которой участвовала эта сделка. Каждая позиция имеет уникальный идентификатор, который присваивается всем сделкам, совершенным на инструменте в течение всей жизни позиции.
   
   }

I think if we compare both obtained identifiers, we may find out which of the selected deals belongs to the position. And work with them further.

I had an error here and could not understand what was going on for 20 minutes. My elder brother played tanks for 2 hours, watched McLeod, I returned to the errors - I still do not understand.

'PositionSelect' - declaration without type order.mq5 286 3

'HistorySelect' - declaration without type ordernium.mq5 291 4

'for' - expressions are not allowed on a global scope ordernii.mq5 296 5

 
Compiled, sorry. Looks like I'm further along on my own for now. However, if someone can give me a link to good code for transaction accounting, I'd be grateful.
 

advise how to set a stop line to automatically close an order

 
sergey-777:

advise how to set a stop line to automatically close an order

Have a look at Client Terminal / Trading / Trading Activity / Pending Orders Management
 
papaklass:

You can do this ( ZeroMemory(var) ) to initialize the structures.

In general, is this code correct?

The compiler didn't generate any errors. But I have a feeling that something is wrong, i.e. not rational.

I.e. the question is: is it possible to zero a variable of the extremum structure consisting of arrays of simple types using the ZeroMemory() function?
 
Yedelkin:
So, the question is, is it possible to zero a variable of extremum structure consisting of arrays of simple types using ZeroMemory() function?
I'm more concerned about dynamic arrays... how can they be zeroed?
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5
 
sergeev:

It's the presence of dynamic arrays that bothers me more here... how can they be zeroed?
The documentation says there's no need to stress.

ZeroMemory The function zeroes the variable passed to it by reference.

For objects containing strings and dynamic arrays, ZeroMemory() is called for each member.

For any arrays that are not protected by const modifier, all elements are zeroed.

Reason: