This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
Trade Dispatcher: all trade context is busyBack to topics list | 1 2 |
|
tonyc2a
2005.06.17 00:55
Trade Dispatcher: all trade context is busy
I get this error in my Journal. I do not know what this error means precisely. Obviously there is some sort of bottleneck, but what I am wondering is...Am I causing this error to occur by sending too many orders at once, Or is this an error that is completely out of my control??? Basically I need to know if I'm doing something wrong and what I need to do to prevent it in the future. Thank you for your help, Tony |
|
Slawa
2005.06.17 10:52
any attempt to trade from several expert programs simultaneously brings to this error. to prevent error use IsTradeAllowed function
|
|
MartinCooney
2005.08.09 07:31
I'm not sure whether this has been covered before but what exactly does IsTradeAllowed do? What trade operations does it check ?
I think alot of people have multiple experts running and experiencing trading collisions so some help/guidance and perhaps example code using what you think is a good starting point might prove useful to many people complaining about this subject. Cheers Martin |
|
Slawa
2005.08.09 09:51
IsTradeAllowed checks for Allow Live Trading flag in the expert properties and check whether another expert occupies trade thread (experts process trade operations in the special thread that is only one for all experts)
|
|
Loren
2005.08.10 04:03
I remember MT3 enforced a delay between orders. Two orders couldn't be submitted within 10 seconds (or so) of each other. Does IsTradeAllowed check that, too? Thanks.
Loren |
|
Slawa
2005.08.10 10:28
no check. there is your goodwill
|
|
Vooch
2005.08.10 14:43
Here's an example of how I think it should be used:
DELETED BY AUTHOR BECAUSE IT DIDN'T WORK AS INTENDED. SEE THE CORRECTED VERSION IN THE RESPONSE BELOW.
|
|
Vooch
2005.08.11 01:47
I was talking with Mage and noticed I was still getting TradeDispatch errors, so we talked a bit and he suggested I Sleep() for a bit, so here's an example of what I'm doing.
while(IsTradeAllowed()==False) {
Sleep(100);
Print("Sleeping for 100 milliseconds");
}
if(IsTradeAllowed()==True) {
ticket=OrderSend(Symbol(),OP_BUY,order_lots,order_open,3,order_stoploss,order_takeprofit,ScriptName,MagicNumber,0,Lime);
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) {
// success
} else {
Print("ERROR:",GetLastError()," OP_BUY Close[0]=",Close[0]," OO=",order_open," SL=",order_stoploss," TP=",order_takeprofit," lots=",lots," Bid=",Bid," Ask=",Ask);
}
} else {
Print("Programming Logic Error. I should never reach this point.");
}
|
|
Slawa
2005.08.11 09:50
ok. we'll attempt to reproduce your problem.
how much experts work together at the same time? |
|
Vooch
2005.08.11 09:54
> how much experts work together at the same time?
I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly. When testing it, I got a code #133 ERR_TRADE_DISABLED. - Vooch |
|
Slawa
2005.08.11 11:40
> how much experts work together at the same time? I've got 25 experts running at the same time. Each one might send 1-10 orders through fairly quickly. When testing it, I got a code #133 ERR_TRADE_DISABLED. mamma mia. 10 experts ask "is trade allowed?", 10 experts receive answer "yes of course", 10 experts send order but first expert only trade successfully. other 9 experts are losers and outsiders |
Back to topics list
| 1 2
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
