# how many chart has the same expert run on it ? ( is there a function )

4599

hi;

is there a function to identify : from several  chart is availabe on metatrader , how many of them have the same expert run on them. ?

or how can do this ?

use these case for calculating and used in money management.

Moderator
32842

TIMisthebest:

hi;

is there a function to identify : from several  chart is availabe on metatrader , how many of them have the same expert run on them. ?

or how can do this ?

use these case for calculating and used in money management.

I guess it's your own EA ? So you can, for example, use a global variable to "register" each instance of your EA.
4599

angevoyageur:
I guess it's your own EA ? So you can, for example, use a global variable to "register" each instance of your EA.

yes.

and then ; sum of them return and can see on all those chart we have the same equal number ?

how to count and sum ? ( sorry , i dont understand it )

1.) do you mean by : " GlobalVariablesTotal ()" and then by divide it on the number of global value we have in our expert ?

2.) if there was another ea send global vaue ?

23929

TIMisthebest:

yes.

and then ; sum of them return and can see on all those chart we have the same equal number ?

how to count and sum ? ( sorry , i dont understand it )

1.) do you mean by : " GlobalVariablesTotal ()" and then by divide it on the number of global value we have in our expert ?

2.) if there was another ea send global vaue ?

simplest way is to use a single gv as a counter. your ea can add 1 in oninit and subtract 1 in ondeinit. if any ea crashes or somehow turns off or reinitialized without deinitializing though the count would be incorrect until you manually fix it... to circumvent that it seems like it will be a bit of work, I think you may have to use timestamps in individual gv's.

Why do the ea need to know this?

23929

It might even be better to create a single ea that trades on multiple timeframes and currencies instead of trying to communicate between instances of the same ea:

https://www.mql5.com/en/articles/105

• 2010.07.08
• Nikolay Kositsin
• www.mql5.com
The concept of diversification of assets on financial markets is quiet old, and has always attracted beginner traders. In this article, the author proposes a maximally simple approach to a construction of a multi-currency Expert Advisor, for an initial introduction to this direction of trading strategies.
4599

bendex77:

simplest way is to use a single gv as a counter. your ea can add 1 in oninit and subtract 1 in ondeinit. if any ea crashes or somehow turns off or reinitialized without deinitializing though the count would be incorrect until you manually fix it... to circumvent that it seems like it will be a bit of work, I think you may have to use timestamps in individual gv's.

Why do the ea need to know this?

hi & thank you.

because of money management.

assume i want to have sum of volume ( lat ) for all my positions limited to 1 lot for every 10000\$ balance,.

then ea divided the lot for each chart and send order such that total vol will be as we want i .

and if number of chart who has this expert , changed ; it can automatically redistribution .