Download MetaTrader 5
To add comments, please log in or register
Have you developed a trading robot? Publish it in the Market and make profit!
Josh Calow
39
Josh Calow 2016.03.18 15:42 

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 ) 
  {
Keith Watford
Moderator
7979
Keith Watford 2016.03.18 21:01  

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

Vasyl Nosal
18216
Vasyl Nosal 2016.03.18 22:38  
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)
/
To add comments, please log in or register