Easy Easy not even a question!

 

this is not a matter of being lazy or not I just need a second eye to seek where my unbalanced parenthesis is because I can not find it :(

ty to anyone who help me

int OrderWatch()
   {
      int eldest;
      double eprofit;
      double profitsince = 0;
      int etype;
      double elots;
      string esymbol;
      datetime now = Time();
      datetime eldestopentime = 0;
      for (int finder;OrdersTotal()-1;finder>=0;finder--)
         {
            OrderSelect(finder,SELECT_BY_POS,MODE_TRADES);
               if ((OrderOpenTime()+(mindays*86400) < now) && ((OrderOpenTime() < eldestopentime) || (eldestopentime == 0))
               eldestopentime = OrderOpenTime();
               eldest = OrderTicket();
               eprofit = OrderProfit();
               etype = OrderType();
               elots = OrderLots();
               esymbol = OrderSymbol();
         }
      for (int histo;OrdersHistoryTotal()-1;histo>=0;histo--)
         {
            OrderSelect(histo,SELECT_BY_POS,MODE_HISTORY);
               if (OrderCloseTime() > eldestopentime) profitsince+OrderProfit();
         }
      if (eprofit > (profitsince*expiratorrate * -1) && (etype == OP_BUY))
         OrderClose(eldest,elots,MarketInfo(esymbol,MODE_BID), SLIPPAGE, Red);
      if (eprofit > (profitsince*expiratorrate * -1) && (etype == OP_SELL))
         OrderClose(eldest,elots,MarketInfo(esymbol,MODE_ASK), SLIPPAGE, Red);
   }
 
liquidd:

this is not a matter of being lazy or not I just need a second eye to seek where my unbalanced parenthesis is because I can not find it :(

ty to anyone who help me

Here I think . . .

if (   (OrderOpenTime()+(mindays*86400) < now)   &&  (  (OrderOpenTime() < eldestopentime)  || (eldestopentime == 0) )   <-------  missing here ?
 
liquidd:

this is not a matter of being lazy or not I just need a second eye to seek where my unbalanced parenthesis is because I can not find it :(

ty to anyone who help me

Hi Liquidd,

Since you have not provided the entire code, the error may or may not be in the section you posted.

To better help you with this and for the future so you can find your own bracket and parenthesis errors...

You can use NotePad++ to match up the brackets and parenthesis to find the missing one(s).

It is really helpful...and free.

Hope this helps,

Robert

 
  1. Don't write impenetrable code
    if( (OrderOpenTime()+mindays*86400 < now)
     && (  OrderOpenTime() < eldestopentime
        || eldestopentime == 0
        )
      ){  <-missing
            eldestopentime  = OrderOpenTime();
            eldest          = OrderTicket();
            eprofit         = OrderProfit();
            etype           = OrderType();
            elots           = OrderLots();
            esymbol         = OrderSymbol();
      }  <-missing

  2.          for (int finder;OrdersTotal()-1;finder>=0;finder--)
             {
                OrderSelect(finder,SELECT_BY_POS,MODE_TRADES);
    This won't compile (missing equal sign.) No magic number makes this EA incompatable with every other (including itself on other charts) and manual trading. Always test return codes.
        for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
            OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
        &&  OrderMagicNumber()  == magic.number             // my magic number
        &&  OrderSymbol()       == Symbol() ){              // and my pair.
    

 
WHRoeder:
  1. Don't write impenetrable code
  2. This won't compile (missing equal sign.) No magic number makes this EA incompatable with every other (including itself on other charts) and manual trading. Always test return codes.


this is a global orders manager for multi-ea and actually it requires to be working with all orders of the account in order to do what I want it to do.

Reason: