Running multiple EAs on one mt4 terminal

 
Hello I have created an ea that I will be running on 28 different forex pairs. Which means I will have 28 charts open each running the EA. I have noticed that some people have multiple mt4 terminals and each one runs a single ea. Could you explain the advantages of this. Is it ok for me to run everything on a single mt4 terminal. Also do you think mt4 will be able to handle this and not crash. I am also considering getting a VPS so how much ram is suitable for running this many EAs. 
Any help is much appreciated Thankyou
 

Forum on trading, automated trading systems and testing trading strategies

Help! Can it possible to run multiple EAs with the same symbol in MT5 Netting mode independent?

Sergey Golubev, 2021.07.04 08:27

...

---------------- 

I do not know about any special limitation of this broker with netting and FIFO, but as far as I know - we (any trader) can use as many EAs for same symbol as we want.
The different is only with the magic number of the EA.
I mean:

  • open the chart with the symbol and attach EA to the chart;
  • open the other chart with same symbol and attach same or other EA to the chart (EA should have different magic num ber from the first EA),
  • and so on.

What is the magic number?
Metatrader is identifying the trade based on this number (for exampe, trade with number 12345 came from EA #1, and so on).
We can set those numbers in the settings/parameters of the EAs.
All the coders and most of the traders know about it.


 
samsgtw:
Hello I have created an ea that I will be running on 28 different forex pairs. Which means I will have 28 charts open each running the EA. I have noticed that some people have multiple mt4 terminals and each one runs a single ea. Could you explain the advantages of this. Is it ok for me to run everything on a single mt4 terminal. Also do you think mt4 will be able to handle this and not crash. I am also considering getting a VPS so how much ram is suitable for running this many EAs. 
Any help is much appreciated Thankyou

MT4 is a SINGLE Thread application, old application. 

So everything inside it runs Sequencialy.. The more things you put inside it, interferes with others, since is only a single execution pipeline, sequencial.. 

If something (script, EA, Indicator, etc.. piece of your code) slowsdown for some reason, it will slow down every other things running.

Also it only uses 1 processor core, and most laptops/computers nowadays have at least 4 or more cores.. MT4 does not take advantage of them.


Migrate to MT5. 

MT5 is a full multithread application, uses every processor core you give to it, and does not runs things sequencially, so your EA and Indicators and Scripts does NOT slowdown others runnning at the same time.

And MT5 is very, very very much faster than Mt4, incomparable.


You should migrate as soon as possible, and you will jump to a much better world of performance and take advantage or multi thread and multiprocessing in parallel. 


I know it may take sometime to rewrite the code, but its worth the effort. 


People may have multiple MT4 running 1 EA each because of the SINGLE thread limitation.. so they do this as an workaaround, to not let one interfere with anoter.. But is an expensive setup, since you will need to multuply the total computer memory by the number of running instances os Mt4.. and it may take up to 2 ou 3GB for each.. so make some calculations.. 32GB RAM? 64GB? 

Better use Mt5 which will use the same RAM Memory for every instance of EA and the 28 pairs you want. and simultaneosly in paralell, multi CPU core.


About to run multiples EA for the SAME pair, you can attach only 1 EA for each open window. To run more than one EA for the same pair, open 2 windows of the same Pair, and attach one EA to each window.

 
rrocchi:

MT4 is a SINGLE Thread application, old application. 

So everything inside it runs Sequencialy.. The more things you put inside it, interferes with others, since is only a single execution pipeline, sequencial.. 

If something (script, EA, Indicator, etc.. piece of your code) slowsdown for some reason, it will slow down every other things running.

Also it only uses 1 processor core, and most laptops/computers nowadays have at least 4 or more cores.. MT4 does not take advantage of them.


Migrate to MT5. 

MT5 is a full multithread application, uses every processor core you give to it, and does not runs things sequencially, so your EA and Indicators and Scripts does NOT slowdown others runnning at the same time.

And MT5 is very, very very much faster than Mt4, incomparable.


You should migrate as soon as possible, and you will jump to a much better world of performance and take advantage or multi thread and multiprocessing in parallel. 


I know it may take sometime to rewrite the code, but its worth the effort. 


People may have multiple MT4 running 1 EA each because of the SINGLE thread limitation.. so they do this as an workaaround, to not let one interfere with anoter.. But is an expensive setup, since you will need to multuply the total computer memory by the number of running instances os Mt4.. and it may take up to 2 ou 3GB for each.. so make some calculations.. 32GB RAM? 64GB? 

Better use Mt5 which will use the same RAM Memory for every instance of EA and the 28 pairs you want. and simultaneosly in paralell, multi CPU core.


About to run multiples EA for the SAME pair, you can attach only 1 EA for each open window. To run more than one EA for the same pair, open 2 windows of the same Pair, and attach one EA to each window.

The strategy I would like to run is traded on the daily time frame and It does not bother me if trades take a few seconds to execute so having everything running on one mt4 does not bother me. I am just wondering if mt4 would crash having 28eas on one terminal.

 
samsgtw: The strategy I would like to run is traded on the daily time frame and It does not bother me if trades take a few seconds to execute so having everything running on one mt4 does not bother me. I am just wondering if mt4 would crash having 28eas on one terminal.

If your EA is well written and efficient, then there should not be much of problem (if you have enough resources CPU/RAM for it). You should test it out on a demo account, with all 28 running, just to make sure.

However, I should call attention to the following:

Make sure your code is efficient and only reads indicators and other data, only on the open of the candle/bar.

Also, most brokers do not allow trading during the last few minutes of the end of the day, nor the first few minutes of the beginning of the day. The MT4 Strategy Tester does not simulate this (unlike MT5), so you probably never picked this up.

So, you will have to code it, so that it only place trades (or close or manage previous trades), after that delay (usually 5 mins, but check your contract conditions to be certain). If you have not done this, then your EA will just generate a whole lot of failed attempts and log errors in your Expert's log.

So, test your EA out, on a Demo account first, just on a one symbol, then on just a few symbols, before you test all 28 on a demo account before trading on a real account.

PS! If the demo account does not have this 5 min delay for trading during the beginning of the day, then add a manual parameter to simulate this delay in your code. This will also allow you to simulate the same delay in the Strategy Tester so you can see its effects on your trading.

Also, watch out for the very large spreads that takes place during the day's open, so you may want to artificially delay the trade even a few minutes more.

EDIT: Another option for more efficiency, since it is only a Daily Open strategy and has to delay trades anyway for contract specifications and/or spread, you can consider rewriting the EA to be a single EA that monitors all the 28 pairs from that single EA, using the OnTimer event instead of OnTick, or a combination of both.
 
samsgtw: Also do you think mt4 will be able to handle this and not crash.

No one can answer that accurately, because all indicators/EAs are different. I assume they are coded properly (only updating bar zero after the initial run.)

I have (MT4) 60+ charts with nine (9) indicators (including one MTF) open on my (4 core) laptop, averaging 15% CPU, 109 MB RAM, 10 MB/s disk. 2020.06.19

 
William Roeder:

No one can answer that accurately, because all indicators/EAs are different. I assume they are coded properly (only updating bar zero after the initial run.)

I have (MT4) 60+ charts with nine (9) indicators (including one MTF) open on my (4 core) laptop, averaging 15% CPU, 109 MB RAM, 10 MB/s disk. 2020.06.19

Thanks that is very helpful. I will have 28 charts with 8 indicators so I can expect similar usage

 
samsgtw:
 mt4 does not bother me. I am just wondering if mt4 would crash having 28eas on one terminal.

Taking apart all other details, and directly answering:

if MT4 it could crash?

  • As a Plataform: No it wont crash, it supports much more than that.
  • As your scenario: make sure all code is well written.
Personally years ago when I was using MT4, I reach to had 20 pairs opened, using 7 indicators each, plus EA, on a MacBook with 8GB RAM, under Parallels running a Windows 7 VM to run MT4, and the processor load was very low. Performed very good. Than once I download a bad written indicator, put it on 3 charts, and got 80% CPU usage and everything slowed down.. So take care about making sure the EA and indicators are well written, and iMT4 will perform very good. 
Reason: