What's wrong with that? - page 6

 
How do I open two orders at the same time? There are EAs that open two orders simultaneously in different directions.
 
sss2019:
How about opening two orders at the same time?
For example, in different accounts or terminals.
 
sss2019:
How do I open two orders at the same time? There are EAs that open two orders simultaneously in different directions.
There are no machine guns that fire from the same barrel at the same time. The bullets go out one at a time.
 
How do I make a pending order be deleted at the right time if it does not work. How to correctly set the date, so that the orders opened every day will be closed at 5 o'clock? Can you please tell me.
 

Let h_time be the closing time of the order in hours. Then the code could look like this:

extern   int h_time = 17;    // время указано по серверу
..........

   datetime c_time = TimeCurrent(); 
   int HourCurrent = TimeHour(c_time);

   // установим c_time в 00:00:00 текущего дня
   c_time = c_time - HourCurrent*60*60 - TimeMinute(c_time)*60 - TimeSeconds(c_time);
   // теперь установим c_time на указанный час
   if (h_time > HourCurrent) //время можем установить, если оно еще не наступило
     c_time = c_time + h_time*60*60;
   else
     c_time = 0;

Besides, we should keep in mind the following nuances: the session is shorter on Friday; there are some holidays; the pending order expiration time cannot be set close to the server time (how close depends on the brokerage company).

 
sss2019:
So once an order has assigned its number to the Ticket variable, there is no need to output it with return, the variable will not be deleted further on the next tick?
In this case it will not be deleted because it is declared globally
 
granit77:
There are no machine guns that fire from the same barrel at the same time. The bullets come out one at a time.

Words of gold.
 

Please help me here.

   if(TimeHour(TimeCurrent()) == 9 && TimeMinute(TimeCurrent()) == 28 && OrdersTotal() == 0)
     {
     if(OrderSend(Symbol(),OP_BUYLIMIT,Lot,Open[0] - 10 * MyPoint,Slippage,0,0,MyComment,16523,0,Green) == true)
       {
       Alert("Ордер открыт");
       }
       else
          {
          Alert("Ошибка ",GetLastError());
          }
     }

Actually, one order is opened, but the Alert("Order is open" ) signal does not go off ; instead, the Alert("Error ",GetLastError ()) goes off ; but that seems to me to be on the next tick

 
sss2019:

Please help me here.

Actually, one order is opened, but the Alert("Order is open" ) signal does not go off ; instead, the Alert("Error ",GetLastError ()) goes off ; but that seems to me to be on the next tick


Since when does OrderSend return true ?
 
Ah I see, but somewhere I've seen a condition like mine, or similar. And how to make the condition to be fulfilled after opening an order?