int AreThereOrders () //Why use an int, the function is a true false question
{
if (OrdersTotal()<1)
{
return1;
}
elseif (OrdersTotal()>0) //No need for the else as you have alreaddy returned if OT is less than 1
{
int i;
for (i=OrdersTotal()-1; i>=0; i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
continue;
if( OrderMagicNumber()!= magic && OrderSymbol()!=Symbol()) //This means that if any order is open that does not have
{ //the magic number or chart symbol, a new order is openedreturn2;
}
}
}
return0 ;
}
What i meant is that i want to open orders in 2 cases - if, no order is open, and if there is already an open order, but it has to be from another EA, so that my new order will be the only order for the specified currency . My idea is to have only 1 order per EA / currency/, so that why i `ve written if the magic number doesn`t match it can open a new order/ because it will be from another EA/ and i will have only 1 per currency. But the problem is that it doesn`t open only 1 order for the currency. Maybe before i didnt explain it very well.
Stan4o1: What i meant is that i want to open orders in 2 cases - if, no order is open, and if there is already an open order, but it has to be from another EA, so that my new order will be the only order for the specified currency . My idea is to have only 1 order per EA / currency/, so that why i `ve written if the magic number doesn`t match it can open a new order/ because it will be from another EA/ and i will have only 1 per currency. But the problem is that it doesn`t open only 1 order for the currency. Maybe before i didnt explain it very well.
more sensible, in my opinion
Then instead of
use
more logical.
What i meant is that i want to open orders in 2 cases - if, no order is open, and if there is already an open order, but it has to be from another EA, so that my new order will be the only order for the specified currency . My idea is to have only 1 order per EA / currency/, so that why i `ve written if the magic number doesn`t match it can open a new order/ because it will be from another EA/ and i will have only 1 per currency. But the problem is that it doesn`t open only 1 order for the currency. Maybe before i didnt explain it very well.
and that is precisely what
achieves
Wow It worked thanks very very much :)))