EAs can not open trade on different symbols at a time

 

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.

 

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.

Documentation on MQL5: Trade Functions / PositionsTotal
Documentation on MQL5: Trade Functions / PositionsTotal
  • www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

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?

 
Niklas Rolf Alexander Schlimm:

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. 

Reason: