MT4 Mulitiple Ea's - need Maximum Trades per terminal/account - page 2

 
Stanislav Korotky:

I think your problem is related to the fact that you missed asynchronous nature of the platform (and this is not a feature of your specific version of MT).

When you use several copies of EA simultaneously, each of them is running in a separate thread concurrently with other instances. So, basically, you use a multi-threaded software (a set of EAs), which is known as requiring a synchronization on global objects in order to prevent collisions. First thought is to use a global variable for this, that is you should read OrdersTotal only when current instance of EA "owns" the global variable. Maybe this article could help.

Please note that synchronization will also imply some time overheads. So if you want an optimized solution, the best thing to do is to refactor exiting EA (strategies) to run in a single copy to process all pairs.

Thanks Everybody for your help, especially Stanislav Korotky.

I just wrapped everything in a FOR loop. The FOR loop cycles though the 28 pairs, inside a timer event.

I don't know why some people frown on this approach, it runs solid as a rock.


Thanks again

Files:
multi-pair.txt  11 kb
 
xazarlx20:

Thanks Everybody for your help, especially Stanislav Korotky.

I just wrapped everything in a FOR loop. The FOR loop cycles though the 28 pairs, inside a timer event.

I don't know why some people frown on this approach, it runs solid as a rock.


Thanks again

What makes you think people frown on it ?

I frown at your earlier method running 28 separate robots.

It's common practice to convert it into one. 

 
Marco vd Heijden:

What makes you think people frown on it ?

I frown at your earlier method running 28 separate robots.

It's common practice to convert it into one. 

I know that this is an old thread... but I am also looking for a way to run an EA on 28 pairs but only allow one trade at a time... Marco you say "convert it into one"? How do you accomplish getting one EA to trade 28 pairs without opening 28 charts?

This would solve a huge problem for me! Thanks! 
Reason: