Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 952

 
A123272:
and don't you look at the error code on the sreen. the fxssi contacts are there as it is, but they say the problem is in mt4.

Who is "they"? Who is "fxssi"? ?

 
Hello. I am drawingOBJ_RECTANGLE on the main chart. But when I scroll in history, the chart is getting wider and narrower, and OBJ_RECTANGLE is getting small and then the text inside OBJ_RECTANGLE is moving out of line of OBJ_RECTANGLE, and then it is moving back. What is the solution to this problem, if OBJ_RECTANGLE is always the same size and the text does not jump out of OBJ_RECTANGLE?
 
Igor Kryuchkov:
Hello. I am drawingOBJ_RECTANGLE on the main chart. But when I scroll in history, the chart is getting wider and narrower, and OBJ_RECTANGLE is getting small and then the text inside OBJ_RECTANGLE is moving out of line of OBJ_RECTANGLE, and then it is moving back. What is the solution to this problem, if OBJ_RECTANGLE is always the same size and the text does not jump out of OBJ_RECTANGLE?
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов / OBJ_RECTANGLE_LABEL
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов / OBJ_RECTANGLE_LABEL
  • www.mql5.com
//| Создает прямоугольную метку                                      |              chart_ID=0,                              sub_window=0,                            x=0,                                     y=0,                                     width=50,                                height=18,                ...
 
Artyom Trishkin:

You need to find the last order which was opened. Find its ticket. Then we will search the list of object names for a substring containing the last order ticket found in the object name line. As soon as the ticket of the last order is found in the object name, this is the necessary graphical object. All that remains is to extract what you need from this graphical object.

int RisB() 
  {    
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS))
        {
         if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
           {
            int Tik=OrderTicket();
           }
        }
     }
   for(int no1=0; no1<ObjectsTotal(); no1++)
     {
      if(OrderTicket()==Tik)
        {
         string Ris=ObjectDescription("LOTB"+OrderTicket());
        }  } return(Ris);}

What's wrong with me? How can I make only open orders be considered? This code still captures partially closed orders which I don't need

 
Rustam Bikbulatov:

How can I make only open orders be considered? This code also captures partially closed orders, which I don't need

You need to use the MODE_TRADES parameter:

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

MODE_TRADES - current orders
MODE_HISTORY - historical

 
Yevhenii Levchenko:

You have to use the MODE_TRADES parameter:

MODE_TRADES - current orders
MODE_HISTORY - historical

is not an option. it does not depend on this

 
Yevhenii Levchenko:

You must use the MODE_TRADES parameter:

MODE_TRADES - current orders
MODE_HISTORY - historical

bool  OrderSelect( 
   int     index,            // индекс или тикет ордера 
   int     select,           // флаг способа выбора 
   int     pool=MODE_TRADES  // источник данных для выбора 
   );

pool=MODE_TRADES

[in] Data source for selection. Used when the select parameter is equal to SELECT_BY_POS. Can be one of the following values:

MODE_TRADES (default) - order is selected among open and pending orders,
MODE_HISTORY - the order is selected among closed and deleted orders.


This parameter is not required at all since it is set by default.

 
Artyom Trishkin:

I have anOBJ_RECTANGLE object linked by price and time, not by coordinates.

 
Rustam Bikbulatov:

What's wrong with me? How can I make only open orders be considered? This code also captures partially closed orders, which I do not need

There is no separation between positions and pending orders in mql4. And furthermore, there is no sifting out of positions left from partially closed ones. In the comment of an order, there is a ticket number from the partial closing of which it is formed. So, we should sift out the ones we do not need according to this comment.

 
Artyom Trishkin:

I need to draw anOBJ_RECTANGLE frame around each bar, and OBJ_RECTANGLE_LABEL is created for GUI design. I need to use OBJ_RECTANGLE, but how can I make it not scale?

Reason: