SYMBOL() AND NULL - page 2

 
biantoro kunarto:

Try this:

This exaxtly what I have used
But
It is not the same as I want
I want
- the expert trades to be counted only
- the pair traded count

Example:
If eurusd short position has manually opened previously. And the current expert has the right condition to Open a short position in the same pair (eurusd). IN THIS CASE OrdersTotal() WILL NOT OPEN THE TRADE!
After some time same expert has a right condition to open another position but in another currency pair.
 
then use magic number ()
 
mmmmm 
It seems that what I want
I am not in home right now
I will try it
MagicNumber()   <<< correct?
 
Marco vd Heijden:
then use magic number ()
no magicnumber function!
 
maybe needs to use the magic number as a variable
 
bool TradeExist(int magic, int type = -1)
{
   for(int cnt=0; cnt<OrdersTotal(); cnt++)
   {
      if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;
      if(OrderMagicNumber()==magic && (OrderType()==type || type==-1))
      return (true);
    }
    return (false);
}

Then use

bool HaveTrades = TradeExist(MagicNumber);
//<<----------------------->>  
 
Ahmed Soliman:

Then use

ok dear

I will try it

thanks for all

thank you