In my understanding, Python has GIL and thus your threads are not really running in parallel, i.e. each thread has to run one by one and this is equivalent to send order in the main thread one by one. This should be the reason why time spent of both ways are roughly the same.
Maybe multiprocessing library can help you overcome this GIL as stated in the document:
multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local and remote concurrency, effectively side-stepping the Global Interpreter Lock by using subprocesses instead of threads. Due to this, the multiprocessing module allows the programmer to fully leverage multiple processors on a given machine. It runs on both POSIX and Windows.
multiprocessing — Process-based parallelism
- docs.python.org
Source code: Lib/multiprocessing/ Availability: not Emscripten, not WASI. This module does not work or is not available on WebAssembly platforms wasm32-emscripten and wasm32-wasi. See WebAssembly p...

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
The MetaTrader 5 Python package offers the order_send() function, analogous to MQL5's OrderSend() .
This is a synchronous function; the caller has to wait for the MT5 server response before proceeding.
When a trading strategy necessitates multiple orders at varying prices or symbols, using the synchronous order_send() consecutively can cause a cumulative wait time.
This delay scales linearly with the number of orders, and can become significant with high network latency.
In MQL5, the asynchronous OrderSendAsync() method can mitigate this issue.
Unfortunately, the MetaTrader 5 Python package lacks such an asynchronous alternative for order_send() .
I'm aiming to develop a Python function mirroring the behavior of MQL5's OrderSendAsync() . My approach involves wrapping each order_send() call in a separate thread for concurrent execution.
Here's the code I've attempted:
Here's the result produced by the above script:
The provided time measurements represent the elapsed time from the start of sending the first order to the completion of the k-th order, for k ranging from 1 to 9. Server ping time was around 120 ms during the experiment.
Based on the results, the elapsed time appears nearly identical for both sequential and concurrent implementations. This implies that the order_send() function might not be executing concurrently, as each subsequent call only seems to initiate after the completion of its predecessor.
Have I made an oversight in my approach?
Why doesn't the order_send() function seem to execute concurrently?
Does anyone have insights, solutions, or suggestions on effectively implementing concurrency for sending orders to the MT5 server using Python?
Thank you in advance.