wow, what is going on here?
Hi,
I think this is a big concern as not handling this problem can cost $$$. I have had a look at the error codes in the dictionary and these are ones I think may need to be handled to get arround this problem
ERR_SERVER_BUSY
ERR_TOO_FREQUENT_REQUESTS
ERR_BROKER_BUSY
ERR_ORDER_LOCKED
ERR_TOO_MANY_REQUESTS
Maybe having some code like.
I think this is a big concern as not handling this problem can cost $$$. I have had a look at the error codes in the dictionary and these are ones I think may need to be handled to get arround this problem
ERR_SERVER_BUSY
ERR_TOO_FREQUENT_REQUESTS
ERR_BROKER_BUSY
ERR_ORDER_LOCKED
ERR_TOO_MANY_REQUESTS
Maybe having some code like.
bool b = true; while (b) { int iStatus = OrderSelect(...); // This could be a OrderSelect, Modify, Send, Delete etc b = CheckBusy(iStatus) //Return true for server busy codes Sleep(10000); //wait 10 seconds before retrying } RefreshRates(); ....... bool CheckBusy(int i) { switch( i ) { case ERR_SERVER_BUSY: case ERR_TOO_FREQUENT_REQUESTS: case ERR_BROKER_BUSY: case ERR_ORDER_LOCKED: case ERR_TOO_MANY_REQUESTS: return (true); } return (false); }
This may or may not work but may be worth testing on demo. Slawa could you please confirm the correct error codes that would need to be checked for in order for this type of action. Also may be worth adding some sort of counter so that you don't end up with and endless loop and maybe even worth sending an email on the first loop that picks up the error that way you are aware that a problem or trade collition exits.
Pedro
Hi,
I think this is a big concern as not handling this problem can cost $$$. I have had a look at the error codes in the dictionary and these are ones I think may need to be handled to get arround this problem
I think this is a big concern as not handling this problem can cost $$$. I have had a look at the error codes in the dictionary and these are ones I think may need to be handled to get arround this problem
You should use IsTradeAllowed( ) function (see "Common functions" topic in MetaEditor navigator).
Hello pedfx,
That was my understanding also.
Alexandr,
The dictionary says,
You also said in another post about this topic:
Would IsTradeAllowed() cause the EA to pause and wait for the other EA to finish its trade operation first, and then allow it to continue as normal?
That was my understanding also.
Alexandr,
The dictionary says,
Returns true if trade is allowed for the expert, otherwise returns false.
I think that this is quite unacceptably vague. You also said in another post about this topic:
So this error message indicates that some trade operation was in progress when you try to do another one.
Would IsTradeAllowed() cause the EA to pause and wait for the other EA to finish its trade operation first, and then allow it to continue as normal?
IsTradeAllowed function was expanded. It check not only for "allow trade" flag in the expert properties but also for freeness of the trade thread that is only one for the all expert trades. There is not allowed simultaneous trades from several EA ie a few experts cannot processed trade operations at the same time
I think this is a big concern as not handling this problem can cost $$$. I have had a look at the error codes in the dictionary and these are ones I think may need to be handled to get arround this problem
ERR_SERVER_BUSY
ERR_TOO_FREQUENT_REQUESTS
ERR_BROKER_BUSY
ERR_ORDER_LOCKED
ERR_TOO_MANY_REQUESTS
ERR_SERVER_BUSY
ERR_TOO_FREQUENT_REQUESTS
ERR_BROKER_BUSY
ERR_ORDER_LOCKED
ERR_TOO_MANY_REQUESTS
i think that enumerated errors definitions are self documented
ERR_SERVER_BUSY - server is busy. ask your broker what is happened
ERR_TOO_FREQUENT_REQUESTS - you cannot send requests every tick without pause
ERR_BROKER_BUSY - your broker processes another request from another client
ERR_ORDER_LOCKED - order that you've send is accepted and cannot be cancelled
ERR_TOO_MANY_REQUESTS - queue of your requests is full
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
"TradeDispatcher: all trade context is busy"