Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 93

 
ivann85:

programmatically )))
What exactly do you need to find? The number on the list? A ticket? And if there's more than one on the eu, this pendulum?
If there are two or three-five-million of them and they all have the same type and hang on the same pair, which one is needed?
 
alexey1979621:

paladin80


artmedia70



So help me with the Expert Advisor- I'll test it from you programming (like the theme of working), otherwise I just hang myself or in two months, when all the forums will rape something will work.








Oh... And the number in your nickname isn't by any chance the planned number of raped forums?

Writing for you is on a dime. Fifty dollars and it's yours. Note - a very democratic price, almost for nothing :))

 
alexey1979621:

paladin80


artmedia70



So help me with the Expert Advisor- I'll test it from you programming (like the theme of working), otherwise I just hang myself or in two months, when all the forums will rape something will work.








We have digested your advisor a little bit, told you the weak points, what to do and how to do it, but I won't be able to make the corrections. There's plenty of code of my own to do.

... quietly off to the cloud to optimise...

 
ivann85:

programmatically )))

Since there's no answer to the question, here's a function that will return the ticket of the last order set:

// Возвращает тикет последнего установленного/открытого ордера
int TicketLastOrder(string sy, int op, int mn) {
   datetime t;
   int      i, j=-1, tic=0, k=OrdersTotal()-1;
   for (i=k; i>=0; i--) {
      if (OrderSelect(i,SELECT_BY_POS)) {
         if (OrderMagicNumber()!=mn)   continue;
         if (OrderSymbol()!=sy)        continue;
         if (OrderType()!=op)          continue;
         if (t<OrderOpenTime()) {
            t=OrderOpenTime();
            j=i;
            }
         }
      }
   if (OrderSelect(j,SELECT_BY_POS)) tic=OrderTicket();
   return(tic);
}
// -------------------------------------------------------------
/*
Ордера фильтруются по символу (sy), типу (op) и магику (mn)
Чтобы найти тикет последнего установленного ордера BuyLimit 
с магиком Magic на текущем графике,
нужно вызвать функцию с такими параметрами:
int Ticket=TicketLastOrder(Symbol(), OP_BUYLIMIT, Magic);
Если есть такой ордер, функция вернёт номер его тикета.
В противном случае, ф-ция вернёт ноль
*/
 

I occasionally, but not constantly, get a 4200 error when I set a pending order. According to the documentation this error means that the object already exists:

ERR_OBJECT_ALREADY_EXISTS4200Объект уже существует


It turns out that an order of this type is already in the market when the pending order is sent?

 
hoz:

I occasionally, but not constantly, get error 4200 when I place a pending order. According to the documentation this error means that the object already exists:

ERR_OBJECT_ALREADY_EXISTS4200Объект уже существует


It turns out that the order of this type is already in the market when the pending order is sent?

This error applies to graphical objects, not to orders
 
Good evening, Victor! Strange, the pending order is not an object! Maybe you have some object that should have already been deleted, but wasn't!
 

Can you advise me, friends? This is the first time I'm writing an EA working with several pending orders at the same time, so I'm wondering... what kind of errors can there be when opening pending orders? What should we focus on in the error handling function? Could there be errors such as 4(trade server is busy) or 146(trading subsystem is busy)? Share if you know.

 
Dozol:

Can you advise me, friends? This is the first time I'm writing an EA working with several pending orders at the same time, so I'm wondering... what kind of errors can there be when opening pending orders? What should we focus on in the error handling function? Could there be errors such as 4(trade server is busy) or 146(trading subsystem is busy)? Share if you know.

Anything can happen on the real world. Handle, if possible, any trading errors that may occur.
 

Please advise!!!

I am writing pending orders at a certain time

{

Define open time

}

if ((condition)==true)//
{
OrderSend ( OP_BUYSTOPP, parameters);// open a pending BuyStop order
OrderSend ( OP_SELLSTOP, parameters);// open a pending SellStop order
}

I think I wrote the time correctly; it detect it but for some reason, it opens either Sell Stop or Buy Stop and doesn't open two orders at once. I try to open two pending orders of different types (Bistop and Sellstop) at the same time and one by one. The question seems to be primitive, please help the dummies) Thank you!)

Reason: