Global Variable Scope

 

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.

 
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
 
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.

Reason: