Simultaneous orders execution

 

Hello coders,

I'm trying to solve the problem of multiple orders realisation. In this article there's a description of how ordersend function works:

"

4.Execution of the function OrderSend():

4.1. The function formed a trade request for opening of an order and passed this request to the client terminal.

4.2. The function passed the control to the client terminal simultaneously with passing of the trade request, so the program execution was stopped.

4.3. The client terminal checked the received trade request. It didn't detect any incorrect parameters, so it sent the request to the server.

4.4. The server received the trade request, checked it, didn't detect any incorrect parameters, and decided to execute the request.

4.5. The server executed the request by making a transaction in its database and sent the information about that executed request to the client terminal.

4.6. The client terminal received the information about that the last trade request had been executed, displayed this event in the terminal window and in the symbol window, and returned the control to the program.

4.7. Once having received the control, the program continued working from the location, from which the control had previously been passed to the client terminal (and to which it had been returned later).

"

So orders are executed one after another, because MT4 halts the program when an order is sent. The below code will execute three orders one after another, but not at the exactly same time:

OrderSend("USDJPY",OP_BUY,14.9,MarketInfo("USDJPY",MODE_ASK),100,0,0,"1",1,Green);
OrderSend("EURUSD",OP_BUY,10,MarketInfo("EURUSD",MODE_ASK),100,0,0,"2",2,Green);
OrderSend("EURJPY",OP_SELL,10,MarketInfo("EURJPY",MODE_BID),100,0,0,"3",3,Green);


which is confirmed by the log:

2009.10.15 14:06:42 '500406279': order was opened : #1348140 buy 10.00 EURJPY at 134.082 sl: 0.000 tp: 0.000
2009.10.15 14:06:38 '500406279': request was accepted by server
2009.10.15 14:06:32 '500406279': order buy market 10.00 EURJPY sl: 0.000 tp: 0.000
2009.10.15 14:06:32 '500406279': order was opened : #1348136 sell 10.00 EURUSD at 1.48478 sl: 0.00000 tp: 0.00000
2009.10.15 14:06:25 '500406279': request was accepted by server
2009.10.15 14:06:21 '500406279': order sell market 10.00 EURUSD sl: 0.00000 tp: 0.00000
2009.10.15 14:06:21 '500406279': order was opened : #1348131 sell 14.90 USDJPY at 90.242 sl: 0.000 tp: 0.000
2009.10.15 14:06:17 '500406279': request was accepted by server
2009.10.15 14:06:14 '500406279': order sell market 14.90 USDJPY sl: 0.000 tp: 0.000


as you can see from the log, the execution of 3 orders takes 28 seconds. And now the question:

How can I shorten this time, but without the necessity of moving near my broker's servers ;) ?

Any suggestions?

Cheers,

Tom

Reason: