EA Memory Management

 

Hi All,

I am developing EA for the first time and I would like to know about how the memory is managed when the EA is attached to multiple currenty pairs, do they share same memory or different memory?

If I attach EA to 2 pairs, will it start two different instances of the EA and has no related between between?

Like if I attach the EA to two differet pairs, if the EA one pair updates certain static variables will it affect the other pair which is attached to another instance of EA on the same MT4 platform?

Thanks

Regards,

Arun

 
Like if I attach the EA to two differet pairs, if the EA one pair updates certain static variables will it affect the other pair which is attached to another instance of EA on the same MT4 platform?


No.


I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I will move your topic to the MQL4 and Metatrader 4 section.

 
balas009:

Hi All,

I am developing EA for the first time and I would like to know about how the memory is managed when the EA is attached to multiple currenty pairs, do they share same memory or different memory?

If I attach EA to 2 pairs, will it start two different instances of the EA and has no related between between?

Like if I attach the EA to two differet pairs, if the EA one pair updates certain static variables will it affect the other pair which is attached to another instance of EA on the same MT4 platform?

Thanks

Regards,

Arun

They are independent.  Each instance of a program has it's own variable set.

If you want to share certain variables then you will need to use Global Variables (not to be confused with the variables declared in the global space of a program)

https://www.mql5.com/en/docs/globals

Documentation on MQL5: Global Variables of the Terminal
Documentation on MQL5: Global Variables of the Terminal
  • www.mql5.com
Global variables are kept in the client terminal for 4 weeks since the last access, then they will be deleted automatically. An access to a global variable is not only setting of a new value, but reading of the global variable value, as well.
Reason: