MT4 order threads limitation??

To add comments, please log in or register
ccou
261
ccou  

Hi,

I've been told that MT4 can only support 16 order threads. Is it true ?

How can I verify this limtation, technically ?

Thanks

William Roeder
20210
William Roeder  
  1. I thought it was raised to 8 on Build 600 and Higher. 2014.02.03

  2. Have n charts look at IsTradeContextBusy before simultaneously sending orders.
ccou
261
ccou  

Thank you William, sorry but I don't really understand how IsTradeContextBusy would help as it simply Returns true if a thread for trading is occupied by another EA or not.

IsTradeContextBusy sounds very slow to me... by the time it would tell you if a thread for trading is occupied by another EA or not, context may change quickly.

From my understanding, to find this order threads limit number, I would need to open n charts that would simultaneously  send or modify or delete orders using EAs.

Is it possible "simultaneously" OrderSend/Modify/Delete are so quick...

I would need to test 2, 3, 4.... n charts, until one of the OrderSend/Modify/Delete returned value would be false and its error code = 4 = Trade server is busy, is it correct?

Is the order threads limit number :

1) per Account?

2) per Magic number?

3) per Terminal?

Thanks!

IsTradeContextBusy - Checkup - MQL4 Reference
IsTradeContextBusy - Checkup - MQL4 Reference
  • docs.mql4.com
IsTradeContextBusy - Checkup - MQL4 Reference
William Roeder
20210
William Roeder  
ccou: and its error code = 4 = Trade server is busy, is it correct?
  1. No, server busy is not terminal threads busy. If trade context is busy, nothing will be sent to the server. I don't know what error code you would get.

  2. OrderSend/Modify are not quick.
    The microseconds the EA takes is irrelevant, compared to the 20-200 milliseconds the network takes, which is irrelevant compared to the minutes to do a trade because of the servers during news.

    OrderSend sends the request, network delivers, placed in the server queue. Once it reaches the top of the queue, you get filled or not, and the result delivered back to the terminal. Normally it is the 20-200 milliseconds the network takes to deliver is the limiting factor, but it can take minutes to do a trade because of the servers during news.

  3. I still don't understand why you are concerned. Do you really expect n charts to try to open an order, in the same, exact, second? If a open/modify fails, don't you retry on the next tick? What do you do if you get no result? You have to wait for the terminal to reconnect and then check if the order has opened or not.

  4. Never risk more than a small percentage of your account, certainly less than 2% per trade, 6% total. To do that, you need a mutex around your current risk to open order code, and will only use one thread.
              Prevent EA from opening trades at the same time across two or more pairs? (Steve) - MQL4 programming forum 2016.06.21
To add comments, please log in or register