Download MetaTrader 5
To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
Forex Trader
114252
Forex Trader 2006.01.19 05:56 
I know that this issue has been talked about many times here but in v 188 it is even more of a problem. I am looking at IsTradeAllowed() ==true to place an order and it is always busy. I get a Trade Context busy error over and over...Is this planned to be fixed soon? Otherwise the EAs cannot place orders properly. Any recommendations on a workaround?
Forex Trader
114252
Forex Trader 2006.01.19 12:52  
I know that this issue has been talked about many times here but in v 188 it is even more of a problem. I am looking at IsTradeAllowed() ==true to place an order and it is always busy. I get a Trade Context busy error over and over...Is this planned to be fixed soon? Otherwise the EAs cannot place orders properly. Any recommendations on a workaround?

As far as I am aware, MetaQuotes does not have a proper solution available. I'm working on one right now. Compare with "MQL4: Order serliazer?"

All I need to know, is what are the conditions that the server returns this error? Can somebody from Metaquotes explain it?
Forex Trader
114252
Forex Trader 2006.01.19 17:29  
Only one expert of all ones can process trading functions at the same time because there is only one trade context for all experts. If some expert trades then another expert receives "trade context busy" at the same time.
Forex Trader
114252
Forex Trader 2006.01.19 18:36  
Only one expert of all ones can process trading functions at the same time because there is only one trade context for all experts. If some expert trades then another expert receives "trade context busy" at the same time.

Does it mean that the error is generated on the client side? In other words, is the trading function on client or on the server side. If it is a client issue, then implementing orders FIFO should solve the problem.
Forex Trader
114252
Forex Trader 2006.01.19 19:09  
Yes, on client side.
Sorry, no fifo queue for trading operations. You need to control your operations yourself.
Forex Trader
114252
Forex Trader 2006.01.22 11:10  
Slawa,

How does the server know to send a 'Trade Context Busy' error to an EA ?

Is this identified by the trading server that an IP address is sending to many requests?
Is this identified by the trading server that a particular EA is sending to many requests?

Martin
Forex Trader
114252
Forex Trader 2006.01.23 01:34  
Slawa,

How does the server know to send a 'Trade Context Busy' error to an EA ?

Is this identified by the trading server that an IP address is sending to many requests?
Is this identified by the trading server that a particular EA is sending to many requests?

Martin

Martin,

as I understand it from Slawa, it is not server generating this error but client. Trading thread (context) cannot accept another trading function call before it finish the first one.
Forex Trader
114252
Forex Trader 2006.01.23 01:38  
So one instance of MT4 running side by side another instance of MT4 won't affect the trading thread (context) of one another ?
Forex Trader
114252
Forex Trader 2006.01.23 11:24  
So one instance of MT4 running side by side another instance of MT4 won't affect the trading thread (context) of one another ?

Yes, I think so. Would be nice if MQ can confirm it.
Forex Trader
114252
Forex Trader 2006.01.23 12:30  
This, to me, can be attributed to the laziness of the MT4 programmers. It has been said that it is the job of the EA programmer to implement a queue system, however, it is not the EA programmers fault that the trade context has not finished processing the previous order. The EA may be the only strategy running, it could also be one of many, but it should not have to worry about the actions of other EAs. It should be the role of the trading platform to manage the submission of trades instead of preventing them. That is, proactive NOT reactive.

Orders should be processed in a first come, first serve fashion. Instead, the EA must continue to bang at the door of the trading context until it achieves its goal. I believe this technique is called polling and I'm sure that its use here is not warranted. Why can't the OrderSend function simply be blocked until it reaches the head of the trading context manager queue? There should also be timeout after which control is passed back to the EA to reaffirm that the appropriate conditions still exist. Perhaps this could be implemented as a callback.

I'm sure I am in no position to dictate the direction of development but I believe this feature would be high up on an EA programmers wish list :) Feel free to release MT4 as open source so that we can all contribute to a bigger and better platform.
Forex Trader
114252
Forex Trader 2006.01.23 13:57  
I'm sure I am in no position to dictate the direction of development but I believe this feature would be high up on an EA programmers wish list :) Feel free to release MT4 as open source so that we can all contribute to a bigger and better platform.

I support this idea 100%. This would be great and a sure way to an unbeatable trading platform.
/ /12
To add comments, please log in or register