Download MetaTrader 5

how to make a variable in EA which is only affected for each symbol (chart)

To add comments, please log in or register
Irwan Adnan
928
Irwan Adnan  

What I mean is if we attached the EA to many charts, calculation of the variable (say "myvar") of one chart does not related to the calculation myvar in another charts.

 for exmpl :

int myvar;
for (i = 0, i < 10, i++)
{
  myvar = myvar + 1;
}

so myvar calculation is : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

 

or should we use an array to myvar so each symbol have their specific variable. 

Alain Verleyen
Moderator
31439
Alain Verleyen  
belido:

What I mean is if we attached the EA to many charts, calculation of the variable (say "myvar") of one chart does not related to the calculation myvar in another charts.

 for exmpl :

so myvar calculation is : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

 

or should we use an array to myvar so each symbol have their specific variable. 

An EA running on 1 chart is totally independent of other EA on other charts, even if it's the same EA.
Irwan Adnan
928
Irwan Adnan  
angevoyageur:
An EA running on 1 chart is totally independent of other EA on other charts, even if it's the same EA.
Well, thank you friend. You make it clear. I was thingking that, because calculation result in my EA is not as my expected. My stupidness. It must be something wrong with my code logic.
To add comments, please log in or register