Hi all,
would like to ask how do you facilitate communication between two or more running EAs. What I want to do is maintain a set upper limit on the percentage of equity at risk, and I want several EAs running on different currency pairs. Say the total at risk would be 10% and each trade is set at 1% risk. One way I see this is when an EA has a signal to open a trade, I want it to check a global variable that has the current total percentage at risk, if less than 10%, continue with the trade and increment the global variable (if not, forget the trade).
The question here is if the operation is atomic in execution, what little I remember from college OS concepts is that aside from the global variable containing the percentage at risk I also need a global variable saying whether or not the percentage at risk variable is in use (a lock so to speak). I believe there's a function that sets a value to a global variable but first checks it's current value, this could be used if it's execution is atomic right?
I asked here in case someone has already done this (or remembers their OS concepts course

).