Download MetaTrader 5

Do different EAs share variable names?

To add comments, please log in or register
Akif Mushtaq
130
Akif Mushtaq  

I understand the concept of global variables. What I wanted to know is, if I have 2 different EAs running at the same time, and both of them have a variable defined as "TargetProfit", will this variable function independently for each EA? or will the EAs get confused? Should i label my variables differently in each EA? eg, 'TargetProfit1' and 'TargetProfit2'?

Marco vd Heijden
Moderator
5354
Marco vd Heijden  
Akif Mushtaq:

 or will the EAs get confused? Should i label my variables differently in each EA?

No.
Stuart Browne
6246
Stuart Browne  
As Marco said, if you're talking about indicator/EA/script scope global variables then no, each will operate independently within their own thread even if they're named the same. You will only get problems if you are using Terminal scope Global variables. Then each instances of the EA will overwrite the variable
To add comments, please log in or register