Download MetaTrader 5

Global Variable Scope

To add comments, please log in or register
jt27
74
jt27  

I've been using the GlobalVariable....() functions to create my global variables for my EA but am wondering if I'm making life too difficult for myself.


I will be running this EA on multiple charts in the same terminal at the same time and have been using the GlobalVariable...() functions to avoid any potential conflicts with variables between charts.  I've got some input variables.  If I assigned these to global variables in my EA (not using the GlobalVariableSet() function) and then run the EA on multiple charts in the same terminal, am I going to experience any issues with conflicting variable names between charts?  Keep in mind I have no need to access the variables from one chart to another.

Alain Verleyen
Moderator
33796
Alain Verleyen  
jt27:

I've been using the GlobalVariable....() functions to create my global variables for my EA but am wondering if I'm making life too difficult for myself.


I will be running this EA on multiple charts in the same terminal at the same time and have been using the GlobalVariable...() functions to avoid any potential conflicts with variables between charts.  I've got some input variables.  If I assigned these to global variables in my EA (not using the GlobalVariableSet() function) and then run the EA on multiple charts in the same terminal, am I going to experience any issues with conflicting variable names between charts?  Keep in mind I have no need to access the variables from one chart to another.

You are confusing global variables and Global Variables of the Terminal. You don't need the latter if each EA is independent.
Global Variables of the Terminal - MQL4 Reference
Global Variables of the Terminal - MQL4 Reference
  • docs.mql4.com
Global Variables of the Terminal - MQL4 Reference
jt27
74
jt27  
Alain Verleyen:
You are confusing global variables and Global Variables of the Terminal. You don't need the latter if each EA is independent.

Thank you.

To add comments, please log in or register