"How can I filter to see if my current EA with magic number x have a open position?"
Your code is already doing that: loop over all open positions and filter by magic number. Then count the number of open positions which have this magic number. If the total quantity is larger than zero you have an open position. You can also create the sum of the total position size to see whether you are long, short, or flat.
Hello
I'm building multiples EA for EURUSD, but there are some conflicts when they open a posiition.
How can I filter to see if my current EA with magic number x have a open position?
PS: There are more than 3 EA's. I didnt put all together because I wont be able to backtest .
I strongly recommend against using PositionSelect .
Always work on this algorithm: Example: the number of all positions for current symbol and for which the Magic number matches the specified parameter 'magic number':
This is an example of an Expert Advisor that calculates positions BY CURRENT SYMBOL and by TASKED Magic number.
- www.mql5.com
I strongly recommend against using PositionSelect .
Always work on this algorithm: Example: the number of all positions for current symbol and for which the Magic number matches the specified parameter 'magic number':
This is an example of an Expert Advisor that calculates positions BY CURRENT SYMBOL and by TASKED Magic number.
Thanks, I'm going to take a look
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I'm building multiples EA for EURUSD, but there are some conflicts when they open a posiition.
How can I filter to see if my current EA with magic number x have a open position?
PS: There are more than 3 EA's. I didnt put all together because I wont be able to backtest.