Hi guys,
Is there a way in MT4 to send several orders at the same tick time without waiting for each order to be executed..
I mean market orders, not pendind conditional orders..
THANKS
Not with MT4's available tools.
There are some helpful scripts for such actions in Codebase and the Market.
Hi guys,
Is there a way in MT4 to send several orders at the same tick time without waiting for each order to be executed..
I mean market orders, not pendind conditional orders..
THANKS
Yes, with conditions.
- within step sequence function. (finite numbers of order that is predefined within the function)
- same symbol
Hi Mohamad..
Thanks for your reply. Could you be more explicite about your 1. condition ? Yes it is for same symbol ...
Thanks Emma,
Thanks Emma,
No worries, however, multiple EAs is the only way to send async orders with MT4, and it's really no work at all once you launch your charts and apply the EA templates programmatically.
Hi Mohamad..
Thanks for your reply. Could you be more explicite about your 1. condition ? Yes it is for same symbol ...
example psedo-code function code below applied to script (it's single tick execution)
i know it's not the best hardcoding example, but you get my point.
you need to specify finite numbers of order in the function (below case, 5 with different magic number)
void MultipleMarketOrder() { RefreshRates(); int ticket1 = OrderSend(_Symbol,OP_BUY,0.01,Ask,slippage,0,0,"",magic1); while(IsTradeContextBusy()) Sleep(1); int ticket2 = OrderSend(_Symbol,OP_BUY,0.01,Ask,slippage,0,0,"",magic2); while(IsTradeContextBusy()) Sleep(1); int ticket3 = OrderSend(_Symbol,OP_BUY,0.01,Ask,slippage,0,0,"",magic3); while(IsTradeContextBusy()) Sleep(1); int ticket4 = OrderSend(_Symbol,OP_BUY,0.01,Ask,slippage,0,0,"",magic4); while(IsTradeContextBusy()) Sleep(1); int ticket5 = OrderSend(_Symbol,OP_BUY,0.01,Ask,slippage,0,0,"",magic5); }
however, if you applied it to EA, you need to specify which incoming tick to execute the function.
the best would be at the beginning of newbar.
if(NewBar(PERIOD_M5) && TimeCurrent()==SomeTime) MultipleMarketOrder();
hope it helps.
example psedo-code function code below applied to script (it's single tick execution)
i know it's not the best hardcoding example, but you get my point.
you need to specify finite numbers of order in the function (below case, 5 with different magic number)
however, if you applied it to EA, you need to specify which incoming tick to execute the function.
the best would be at the beginning of newbar.
hope it helps.
I think this is what OP is trying to avoid since this is an example of synchronous operation... In this example; order#1 is sent to the broker-server and the function waits for a result. Only after confirmation of order#1 and checking the trade context can it proceed to place order#2, which could take seconds.
void OpenOrders( const int ordes, const int type, const double lot, const int slippage, const double sl, const double tp, const string comment, const int magic) { if( type != OP_BUY && type != OP_SELL ) return; for(int cnt=0; cnt<ordes; cnt++) if( OrderSend( _Symbol, type, lot, (OP_BUY ? Ask : Bid), slippage, sl, tp, comment, magic) ) continue; }
I think this is what OP is trying to avoid since this is an example of synchronous operation... In this example; order#1 is sent to the broker-server and the function waits for a result. Only after confirmation of order#1 and checking the trade context can it proceed to place order#2, which could take seconds.
ah my bad, re-read the OP question, your solution is way to go.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
Is there a way in MT4 to send several orders at the same tick time without waiting for each order to be executed..
I mean market orders, not pendind conditional orders..
THANKS