Is this information is true about MT4 & MT5 Trade Context Memory?

 

Hello,

I came across information on the EarnForex forum stating that MT4 has only 1 trade context, which is why it often shows error 146 ("Trade context busy"). On the other hand, MT5 has 8 trade contexts, making it more suitable for Algo trading because it is unlikely for all 8 trade contexts to be busy at the same time. Can anyone confirm if this information is accurate?


Thank you :)

 
anuj71:

Hello,

I came across information on the EarnForex forum stating that MT4 has only 1 trade context, which is why it often shows error 146 ("Trade context busy"). On the other hand, MT5 has 8 trade contexts, making it more suitable for Algo trading because it is unlikely for all 8 trade contexts to be busy at the same time. Can anyone confirm if this information is accurate?


Thank you :)

What is the context of this conversation about context?

What do you mean by trade context?

 
Old term https://www.mql5.com/en/articles/1412

The "trade context" in MT4 determines whether EA or script can execute trades. In MT4, there is only one trade context available at a time, which can lead to errors like "Trade context busy" (Error 146) if multiple EAs or scripts attempt to trade simultaneously. This limitation can impact the ability of EAs to open positions successfully.

Need to ensure that the trade context is free before using functions like IsTradeAllowed()

While MT5 offers eight trade contexts, making MT5 more suitable for algorithmic trading due to the reduced likelihood of all contexts being busy simultaneously.

Hope this helps.
Error 146 ("Trade context busy") and How to Deal with It
Error 146 ("Trade context busy") and How to Deal with It
  • www.mql5.com
The article deals with conflict-free trading of several experts on one МТ 4 Client Terminal. It will be useful for those who have basic command of working with the terminal and programming in MQL 4.
 
Carl Schreiber #:
What do you mean by trade context?

How many Trade can be executed and Modified at same time by One or Multiple EA in same Trading account.


Oleksandr Medviediev #:
While MT5 offers eight trade contexts, making MT5 more suitable for algorithmic trading due to the reduced likelihood of all contexts being busy simultaneously.

In Article URL, which you provided me, some peoples says in comments that MT4 also have 8 Trade contexts. Is this mean MT4 & MT5 both have same 8 Trade contexts?



 
Please provide some clarity:
 -- clarify your question
 -- clarify what exactly are you aiming to achieve

It is clear that there is a difference in the number of trade contexts between MT4 vs MT5.

MT4 is commonly known to have only 1 trade context, which can lead to errors like "Trade context busy" when multiple trade operations are attempted simultaneously. On the other hand, MT5 is designed with 8 trade contexts, making it more suitable for algorithmic trading due to the reduced likelihood of all contexts being busy at the same time.

Therefore, the claim that MT4 also has 8 trade contexts, as suggested in some comments, contradicts the established understanding that MT4 has only 1 trade context.
 
Oleksandr Medviediev #:
 -- clarify your question

I want to know what the difference between MT4 & MT5 in aspect of Trade Contexts. currently i am using MT4 and i frequently get Error 146 ("Trade context busy")


Oleksandr Medviediev #:
 -- clarify what exactly are you aiming to achieve

my EA is hyperActive. it frequently call functions like OrderSend(), OrderClose() and OrderModify(). I am just trying to find solution to above Error 146. If MT5 is really have more Trade Context than MT4, than i will upgrade my EA from MQL4 to MQL5. For that reason, i am looking for correct information.

 
Hello, what is Trade Context?
 
anuj71 #:

I want to know what the difference between MT4 & MT5 in aspect of Trade Contexts. currently i am using MT4 and i frequently get Error 146 ("Trade context busy")


my EA is hyperActive. it frequently call functions like OrderSend(), OrderClose() and OrderModify(). I am just trying to find solution to above Error 146. If MT5 is really have more Trade Context than MT4, than i will upgrade my EA from MQL4 to MQL5. For that reason, i am looking for correct information.

how to handle error 146 on mt4 -- but not hard to change the code for mt5 use.

https://www.mql5.com/en/articles/1412

library code

https://www.mql5.com/en/code/8235

but if i got a hyperactive msg from my broker then i would move to a different one.

Error 146 ("Trade context busy") and How to Deal with It
Error 146 ("Trade context busy") and How to Deal with It
  • www.mql5.com
The article deals with conflict-free trading of several experts on one МТ 4 Client Terminal. It will be useful for those who have basic command of working with the terminal and programming in MQL 4.
 
kozma14 #:
Hello, what is Trade Context?
Carl Schreiber #:
What do you mean by trade context?

I believe Trade Context means, How many Operation can Metatrader handle from EA/Manual trading on same Tick.

Michael Charles Schefe #:
how to handle error 146 on mt4

I know the solution like IsTradeAllowed(), Sleep(), and TradeIsBusy(). I am not looking for these solution because my EA trade during high impact news time and it made Hyperactive to execute, modify and close trade quickly without delay. That the reason i am looking an alternative solution.


Michael Charles Schefe #:
but not hard to change the code for mt5 use.
Yes, i know. But i can only change my EA code to MQL5, if i have confirmation that MT5 have more trade contexts than MT4, else no use of changing to MT5.
 
anuj71 #:

I believe Trade Context means, How many Operation can Metatrader handle from EA/Manual trading on same Tick.

I know the solution like IsTradeAllowed(), Sleep(), and TradeIsBusy(). I am not looking for these solution because my EA trade during high impact news time and it made Hyperactive to execute, modify and close trade quickly without delay. That the reason i am looking an alternative solution.


Yes, i know. But i can only change my EA code to MQL5, if i have confirmation that MT5 have more trade contexts than MT4, else no use of changing to MT5.

what trades are you trying to open when you get they hyper message? pending or market/instant orders?

 
Michael Charles Schefe #:

what trades are you trying to open when you get they hyper message? pending or market/instant orders?

I am getting an error while Instant Market execution and OrderModify (Modifying SL as Trailing)

Reason: