PositionsTotal returns the TOTAL number of positions.
You need to count the number of positions for EACH of the three symbols. Counting is done in a cycle: all positions are bypassed. If necessary, enable filter by Magic Number.
- www.mql5.com
Agree on @Vladimir Karputov. Also you should use StringCompare to compare Strings. PositionsTotal will give you the count of all open positions in the current symbol.
You could save the ticket number wenn you place the order. This way the expert advisor can check on whether "his" position is open or closed in the current symbol.
Does this help?
Agree on @Vladimir Karputov. Also you should use StringCompare to compare Strings. PositionsTotal will give you the count of all open positions in the current symbol.
You could save the ticket number wenn you place the order. This way the expert advisor can check on whether "his" position is open or closed in the current symbol.
Does this help?
Thank you both gentlemen. I will try and see if it works.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have three different EAs and insert them on three different symbols. However, at a time just one of them can open trade. I want all of them can work independently. I have used bellow code to open trade in all my programs:
**************
if (signal=="sell" && PositionsTotal()<1)
*************
I also have raed that PositionsTotal() refers to positions in current symbol, so there should be no problem. Please advise.