Hello everyone, from my understanding of the documentation, it is implied that you *may* be able to start multiple backtests in parallel by specifying the port of the target agent that will execute it.
Source : https://www.metatrader5.com/en/terminal/help/start_advanced/start
- Port — the port, on which the local testing agent is running. The port should be specified for the parallel start of testing on different agents. For example, you can run parallel tests of the same Expert Advisor with different parameters. During a single test port can be omitted.
My question is can this be used with only 1 installation of MT5, or should I be starting multiple MT5 instances with a different agent port if I want ot run backtests in parallel? Please note that I'm NOT talking about optimization.
Thanks
Short answer:
Yes, for a single installation of MetaTrader 5.
Long Answer:
The MetaTester and MetaTrader are separate applications, and it depends on the number of active MetaTester agents that have been configured and not necessarily on the number of MetaTrader installations.
So the number of MetaTrader applications and the number MetaTester applications is independent of each other.
Please note that the number of active MetaTester agents also depends on the number of processor cores available.
Short answer:
Yes, for a single installation of MetaTrader 5.
Long Answer:
The MetaTester and MetaTrader are separate applications, and it depends on the number of active MetaTester agents that have been configured and not necessarily on the number of MetaTrader installations.
So the number of MetaTrader applications and the number MetaTester applications is independent of each other.
Please note that the number of active MetaTester agents also depends on the number of processor cores available.
Thanks for your reply, I will give you a bit more context.
I'm automating backtests by calling
terminal64.exe /config:myConfig.ini
from the command line.
This starts an instance of Metatrader, does the backtest, then shutsdown (as specified in my .ini file). So even if I call this multiple times with different port, backtest will not start since there's already an instance of terminal64.exe that is running. Which leads me to think I should be looking in duplicating metatrader install folders, and probably use the /portable option.
Is anybody actually achieving parallel backtesting with MT5?
I think you are misinterpreting it mate.
I think that the term 'parallel tests' got you confused and you are trying to interpret it as something else.
I might be wrong here,
As I'm not a native English speaker, I might've missed something in my own interpretation of it,
But for me, the way I understand it, it clearly speaks about optimization.
Even the quote you've provided contains the definition of how the optimization works.
- Port — the port, on which the local testing agent is running. The port should be specified for the parallel start of testing on different agents. For example, you can run parallel tests of the same Expert Advisor with different parameters. During a single test port can be omitted.
Again, I might be wrong,
But I don't see any implication for something other than optimization,
Just an explanation on what the optimization actually is, and how to achieve it when using a configuration file when running from the command line.
Just my 2 cents mate.
I think you are misinterpreting it mate.
I think that the term 'parallel tests' got you confused and you are trying to interpret it as something else.
I might be wrong here,
As I'm not a native English speaker, I might've missed something in my own interpretation of it,
But for me, the way I understand it, it clearly speaks about optimization.
Even the quote you've provided contains the definition of how the optimization works.
Again, I might be wrong,
But I don't see any implication for something other than optimization,
Just an explanation on what the optimization actually is, and how to achieve it when using a configuration file when running from the command line.
Just my 2 cents mate.
You may totally be right, I guess I'll just have to test it, but I would like to know if what I'm about to do is actually achievable.
I just find it weird that someone would specify a port for optimization, when normaly, the optimization will use all available agents regardless of the port, as long as they have been added to the list of agents, and are currently available. In what case someone would need to specify a port ?
You may totally be right, I guess I'll just have to test it, but I would like to know if what I'm about to do is actually achievable.
I just find it weird that someone would specify a port for optimization, when normaly, the optimization will use all available agents regardless of the port, as long as they have been added to the list of agents, and are currently available. In what case someone would need to specify a port ?
After further testing, the port parameter purpose is only to make the backtest's local agent port predictable, instead of using the default 127.0.0.1:3000.
So to achieve what I want to do, I have a script that duplicates the MT5 install folder to user writable location, and starts backtests with multiple MT5 instances running.
You may totally be right, I guess I'll just have to test it, but I would like to know if what I'm about to do is actually achievable.
I just find it weird that someone would specify a port for optimization, when normaly, the optimization will use all available agents regardless of the port, as long as they have been added to the list of agents, and are currently available. In what case someone would need to specify a port ?
The default behaviour when using metatrader's strategy tester is that, unless otherwise specified, all available agents will be used,
And port numbers are automatically assigned to each agent.
For example, I have 3 cores available for testing, so when running optimization the agents are assigned with ports 3000, 3001 and 3002 (or 3001, 3002 and 3003, I can't recall).
I have never tried running metatrader for command line, so I just assumed that the above is not case when running from command line.
Thanks everyone for your inputs, I was able to do what I wanted. If you have any questions on how to automate optimization followed by backtests of results, feel free to hit me up.
Glad to hear you've got it working mate.
What did you do?
I create a NodeJs script that will start MT5 optimization process from command line. Once it is done, it will check every result of the optimization and backtest it against a different time range. So in my "backtest every optimization result" logic, I assign an MT5 instance to a particular backtest task, and run as many as I have MT5 installs spawned (this is config driven as it can depend on the total memory available on your computer). Each MT5 instances gets a specific port 3000, 3001 etc, so the location of generated files (sqlite database in this case) is predictable.
Once everything has done testing, the NodeJs script will then create a report of all the results ordered by net profitability.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone, from my understanding of the documentation, it is implied that you *may* be able to start multiple backtests in parallel by specifying the port of the target agent that will execute it.
Source : https://www.metatrader5.com/en/terminal/help/start_advanced/start
My question is can this be used with only 1 installation of MT5, or should I be starting multiple MT5 instances with a different agent port if I want ot run backtests in parallel? Please note that I'm NOT talking about optimization.
Thanks