Error 146 ("Trade context busy") is due to Broker Server Side or MT4 Client Side? - page 2

 
anuj71 #:
Is that true MT5 have more Trade context compare to MT4?

I don't know.

For a good advisor, the fact that the trading flow is busy does not matter much. Excludes high frequency trading and basket trading. But for this it is better to use MT5 asynchronous trading
 
Vladislav Boyko #:
For a good advisor, the fact that the trading flow is busy does not matter much.

If the EA is reliable and is designed in such a way that it repeats the trade order on the next ticks if the trade order fails on the current tick.

Check whether the trade flow is busy before sending a trade order. If the trading thread is busy, the easiest way is to wait a few seconds (using Sleep) - in most cases this is enough.

But no matter how many checks you add, you cannot be sure that the trade order will be successful. Therefore, the Expert Advisor should be designed taking into account the fact that something can go wrong at any moment, and if something happens, repeat sending a trade order on the next ticks until it succeeds.

 
Vladislav Boyko #:
If the trading thread is busy, the easiest way is to wait a few seconds (using Sleep)

But you should take into account that while you are waiting for the trade flow to become free, a new tick may likely arrive. That is, there is no point in calling RefreshRates and then checking the trade flow.

Immediately before sending the order:

  1. check the trade flow
  2. call RefreshRates
  3. do calculations and checks that require up-to-date data (data such as: ask, bid, stoplevel, etc.)
  4. send an order
 
anuj71 #:

In one of the forum, i read MT5 have 8 Trade context and MT4 have only 1 Context but other part of the forum says MT4 have 8 context too. Any idea how many context does MT4 and MT5 have?

EA is attached to multiple chart. So, yes many trade is getting send or modify at same time. Is that true MT5 have more Trade context compare to MT4?

no idea cept 1: mt4 context  as you call them, were updated awhiles back. but have no idea what that means or how many mt4 or mt5 have now.

 
Michael Charles Schefe #:
no idea cept 1: mt4 context  as you call them, were updated awhiles back. but have no idea what that means or how many mt4 or mt5 have now.


I am asking about this, i read this on different forum

 
yeah i believe that those were the old numbers, but anyways, i am not sure it helps you any does it? even if you are able to limit the trades sent by the eas, I think that you will find the server/broker may hold those extra trades until the next tick, so that you end up having a wrong price on some of the trades. But i have put this thread on my favourites, so that I can monitor the posts. Hopefully a dev or moderator with recent information will post here.
 
Michael Charles Schefe #:
if you are able to limit the trades sent by the eas

This EA trade on news. It trail Pending orders, Stop Loss and Take profits during High impact news time to close losing trade at correct price and closing winning profitable trade at correct price. For this purpose i cannot limit EA from doing actions instantly.


Michael Charles Schefe #:
Hopefully a dev or moderator with recent information will post here.


I hope too, if anyone confirm if above information is correct, than i will convert my MQL4 EA to MQL5.

 
anuj71 #:

This EA trade on news. It trail Pending orders, Stop Loss and Take profits during High impact news time to close losing trade at correct price and closing winning profitable trade at correct price. For this purpose i cannot limit EA from doing actions instantly.

Understood.

Reason: