How many pairs and EAs?

 
I have a good PC (Intel core Duo 2 Ghz with 3 GB RAM). I work with MT4 and EAs.
For each currency pair I have a Windows and a EA running for this pair. The EA is the same for each currency pair.
The issue is that when I open more than 3-4 windows in MT4, everything seems to work ok (logs, PC activity, use of memory, etc.) but not trade is open. On the other hand, less than 3 windows works perfectly.
Can anyone tell what is going on and if there is any way to solve it?
I would like to work with more that 2 pairs at the same time.
Thanks!
 

I believe I know your problem.

MT4 is a single task environment.
This means MT4 tasks can happen one at a time only.

If orders are open, close, or modify at about the same time, nothing gets done.
There is no forking or multitasking.

IN CONCLUSION, you need a multicurrency EA if you want to trade multiple pairs.
It is one EA on one chart BUT it handles all other pairs from different charts.

Look for EAs like that.

I do have a multicurrency EA; however, I ain't selling mine.
And I don't intend to give out anymore free EA.
Do your own homework.

 
ckingher wrote >>

I believe I know your problem.

MT4 is a single task environment.
This means MT4 tasks can happen one at a time only.

If orders are open, close, or modify at about the same time, nothing gets done.
There is no forking or multitasking.

IN CONCLUSION, you need a multicurrency EA if you want to trade multiple pairs.
It is one EA on one chart BUT it handles all other pairs from different charts.

Look for EAs like that.


Sorry ckingher, but in this i dont agree with you.
I guess it is more about the design of the EAs and the used indicators....

I have some "standard" PC, like bruggiafreddo was describing. Connected via WLan on a Standard router with ADSL.
I am running three instances of MetaTrader 24 hours all week long.
1 Liveaccount Broker A with EA on different Charts
1 Liveaccount Broker B with EA on different Charts
1 DemoAccount Broker C
in DemoAccount is always opened 6 Charts in TF 5 Min and 6 Charts (same Pairs like TF 5 min) in TF 30 min .. together 12 Charts
Same EA is running on all 5 min Charts and an other EA is running on all 30 min Charts.
And everyone is opening trades, trailing, closing, winning and loosing :-)
 
EADeveloper wrote >>

Sorry ckingher, but in this i dont agree with you.
I guess it is more about the design of the EAs and the used indicators....

I have some "standard" PC, like bruggiafreddo was describing. Connected via WLan on a Standard router with ADSL.
I am running three instances of MetaTrader 24 hours all week long.
1 Liveaccount Broker A with EA on different Charts
1 Liveaccount Broker B with EA on different Charts
1 DemoAccount Broker C
in DemoAccount is always opened 6 Charts in TF 5 Min and 6 Charts (same Pairs like TF 5 min) in TF 30 min .. together 12 Charts
Same EA is running on all 5 min Charts and an other EA is running on all 30 min Charts.
And everyone is opening trades, trailing, closing, winning and loosing :-)

Please read "Program Execution Order" at https://book.mql4.com/special/index

Your examples are flawed. Why? Because it may work and not work sometime. Okay, so it works. But do you know that it works all the time??
Huh?? Do you know that it works all time??? How do you know when it is not working??? Are you detailed and organized enough to know when it is not working???

Do you even know what happens when tasks occurs at the same time????
In the end, the EAs have to be designed in such a way to handle concurrency problems.
The best solution, multicurrency EA.
 
ckingher wrote >>

Please read "Program Execution Order" at https://book.mql4.com/special/index

Your examples are flawed. Why? Because it may work and not work sometime. Okay, so it works. But do you know that it works all the time??
Huh?? Do you know that it works all time??? How do you know when it is not working??? Are you detailed and organized enough to know when it is not working???

Do you even know what happens when tasks occurs at the same time????
In the end, the EAs have to be designed in such a way to handle concurrency problems.
The best solution, multicurrency EA.


You are right, because everyone with his experience and opinion!
I see in the journal and expert tab if they are working or not in my case and with my Ea's ;-)
The Error-Handling see if they are working or not.
 

Please read my profile.
I have a degree in Computer Science.
I study Computer Database, Computer Software Engineering, COmputer Architecture, etc..., etc...

MT4 does not handle FORKING or MUTLITASKING!! PERIOD!!!
Prove me my statement wrong.
You are not the designer of MT4.
If you think you are so right, let the designer of MT4 speak.

I know I am right 100%.
I designed single currency EAs and multicurrency EAs.
Multicurrency EAs are the best....
But that is not the point.


The POINT is that MT4 does not handle FORKING or MULTITASKING! PERIOD!
This statement is the truth!
I know you cannot prove me wrong. Examples are not good evidence of anything.
Your examples are flawed anyhow.

 

Sorry for the extra blurping.
I get defensive sometime when people annoy me with bad examples and opinions.

 
brugiafreddo:
I have a good PC (Intel core Duo 2 Ghz with 3 GB RAM). I work with MT4 and EAs.
For each currency pair I have a Windows and a EA running for this pair. The EA is the same for each currency pair.
The issue is that when I open more than 3-4 windows in MT4, everything seems to work ok (logs, PC activity, use of memory, etc.) but not trade is open. On the other hand, less than 3 windows works perfectly.
Can anyone tell what is going on and if there is any way to solve it?
I would like to work with more that 2 pairs at the same time.
Thanks!

Please retrieve and print GetLastError() after every call to a trading function (OrderSend(), OrderClose(), etc.). Run the experts and check the experts log. If u get error 146 (ERR_TRADE_CONTEXT_BUSY) frequently, then your problem is multiple experts attempting to use the trade context at the same time.

There's an excellent article that explains the problem and how to deal with it (including code) -> Articles -> Examples -> Error 146 ("Trade context busy") and How to Deal with It.


If this is not your problem, then please post what errors u get and your code. Good luck!

 
brugiafreddo wrote >>
I have a good PC (Intel core Duo 2 Ghz with 3 GB RAM). I work with MT4 and EAs.
For each currency pair I have a Windows and a EA running for this pair. The EA is the same for each currency pair.
The issue is that when I open more than 3-4 windows in MT4, everything seems to work ok (logs, PC activity, use of memory, etc.) but not trade is open. On the other hand, less than 3 windows works perfectly.
Can anyone tell what is going on and if there is any way to solve it?
I would like to work with more that 2 pairs at the same time.
Thanks!


My setup has 20 M1 charts open, 19 currency pairs and one extra currency pair chart open. Same EA exists on the 19 currency pairs simultaneously active. The redundant chart contains another EA I call my "daemon" EA which manages all the globalvariables (money management, portfolio rebalancing, parameter updates, etc) that the other EA's need done for them in the background.

However, as Gordon points out above, my EA's were not intentionally trying to trade >1 currency pair at the exact same instance in time (to the tick) so trade context issues were mostly negated for my multi-currency setup by design. If you haven't factored in the serial nature of trade context in MT4 then that is likely the source of your conundrum.

I only post this info to say to you it can be done so you can rest assured you aren't trying to work towards the impossible.

 

The solution again is that MULTITASKING and FORKING DO NOT EXSIT.

UNDERSTAND THIS: Everything happens ONLY in sequential order on MT4.
This means you will need to put EA in wait mode or something of the nature like using sleep() function.



 
ckingher:

The solution again is that MULTITASKING and FORKING DO NOT EXSIT.

This is wrong.
If this was true then error 146 (ERR_TRADE_CONTEXT_BUSY) could not possibly happen, and EAs that loop with refresh instead of returning from start would not work.
Only indicators and trading are a single context.