Lilith has to work;-) help needed! - page 2

 
Mike12: Here is the sequence of the code i changed
where?
 
if(OrderMagicNumber()==MAGICMA && OrderSymbol()==Symbol()) 
 
Mike12:

Hmmm, Lilith closes now the right trades but not the pending orders. Does somebody know what is missing in the code? Here is the sequence of the code i changed from  the original that closed all the trades.

 


You need to move the brace . . .

void CloseAll()
{
   bool   Result;
   int    i,Pos,Error;
   int    Total=OrdersTotal();
   int    MACGICMA= 0;


   if(Total>0)
   {for(i=Total-1; i>=0; i--) 
     
     {OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     if(OrderMagicNumber()==MAGICMA && OrderSymbol()==Symbol()) 
       {                                                             // move brace to here
       Pos=OrderType();

        if(Pos==OP_BUY){Result=OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, CLR_NONE);}
        if(Pos==OP_SELL){Result=OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, CLR_NONE);}
        if((Pos==OP_BUYSTOP)||(Pos==OP_SELLSTOP)||(Pos==OP_BUYLIMIT)||(Pos==OP_SELLLIMIT)){Result=OrderDelete(OrderTicket(), CLR_NONE);}
Reason: