Issue with TotalOrdersCount

 

I want my EA to only place up to 3 trades, and only once 1 manual trade is already open.

Currently I have set up an external variable of TotalTrades and set this to 3. This is limiting the max trades to 3. I can't seem to work out how to set the requirement of 1 trade already open though.

I effectively want 1< & <TotalTrades but can't seem to get his working.

Any help would be greatly appreciated.

My current if statement is as below:

if( TotalOrdersCount()<TotalTrades ) 
  {
 

There is no standard function called TotalOrdersCount()

Loop through the orders and check OrderMagicNumber(), if it is 0, then the trade was placed manually. This will, of course only work if all trades placed by EAs use a magic number that !=0

 
GumRai:

There is no standard function called TotalOrdersCount()

Loop through the orders and check OrderMagicNumber(), if it is 0, then the trade was placed manually. This will, of course only work if all trades placed by EAs use a magic number that !=0

And it is bad. I propose many times to add finction like OrdersTotal(int type=-1,int magic=-1)
Reason: