Consumption of VPS resources: single EA or multiple EAs ?

 

Hello everyone,

I do not know if this question has already been posted, I used the search function with no success.

Here the matter:
I'm working on a future EA trading 9 pairs at the same time, but I have already two Metatrader4 running on my VPS. This MT4 are already using around 60-65% of the available RAM.
My VPS is running Windows 2012 Server with 1 Giga of RAM.

Here the question:
to minimize the use of resources, it would be better to program a single EA working on 9 currency pairs at the same time, or it is more convenient to simply attach 9 EA to 9 graphs in the MT4?

I think I have enough experience to create an EA in both cases, but I never considered it from "used resources" point of view.
Somebody has experience of the two different approaches?


As corollary:
how much impacts on RAM usage lowering the number of bars in the history? (In the Metatrader: Tools -> Options -> Charts).
I do not plan to look backward in the history in my EA strategy, so I was thinking that reducing the number of bars to a value like 1000 could be beneficial. I'm wrong?

 

If the EAs are single symbol strategies, that don't depend on data from other symbols at all, then they should remain isolated.

If the strategies depend on data of other symbols, for which that data is common between the instances of each EA running, then there would be some improvement in bringing it all together. However, that depends on the strategy rules and how it is supposed to function. A general answer cannot be given. It depends on the situation.

However, irrespective of all this, your first priority should be, to write code logic that is as efficient as possible both in CPU and RAM.

As for less bars on the chart, then yes, reducing the number of bars improves memory consumption.

 

One more thing to note about the number of required bars on chart ... if you are using EMAs or any other indicator or calculation that is based on EMAs, then you will need more bars than you expect.

For example, if you are using an EMA(200), exponential moving average, then you will need 3.45 times more history, approximately 690 bars. For a SMMA(200), smoothed moving average, then you will need double that, approximately 1380 bars. For SMA(200), simple moving average, you only need 200 bars.

 

Hello Fernando,

thanks for your observations.
The EAs are carrying on the same strategy and they does not depends on other Symbols/Currency-pairs. In other words, they are all "isolated" from each other.

The strategy itself is quite simple: it is "activated" by reading an external file containing already the opportune signals. So no "complicated" code here.
Maybe I will have to just add a simple Moving Average indicator on few bars (12?) to make them more "sophisticated".

At the moment I'm more oriented to make nine "copies" of the same EA attached to nine graphs on the MT4. This solution seems also a little bit easier to program than a single EA dealing with more Symbols at the same time...
But I still have not a clear view if this is the best choice when trying to save RAM/CPU resources.


I any case, I will keep in mind your suggestion to keep the code as clean and efficient as possible, and also to reduce the number of bars in the history.

 
Fernando Carreiro #:

One more thing to note about the number of required bars on chart ... if you are using EMAs or any other indicator or calculation that is based on EMAs, then you will need more bars than you expect.

Quite interesting observation, I was not thinking about that. Thanks!

As I wrote above, probably I will need only "short-term" indicators (max 10-12 bars or so), but you nailed an importan aspect that I will have to keep in mind.