Unbalanced Parenthesis

 

I know it's boering to find but I have unbalanced left parenthesis error in my script here is the module I've been working on

- I know there is not ticket management to know witch ea does the trades or manual trading that's how I want it

-This is an order management script to do sorta a martingale into my orders and close when enough profit is reach

      int nOrders=0;
      double pos;
      double ptotal;
      double pprevious = 0;
      double pnow;
      double eprofit;
      datetime otime;
      int eticket;
      int tck;
      int type;
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
         OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
          OrderSymbol()== Symbol())
    {
        nOrders++;
    }
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
         {
         OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
            if (OrderSymbol()== Symbol()
            {
               pnow = OrderProfit();
               ptotal = pnow+pprevious;
               pprevious = ptotal;
               type = OrderType();
               if (OrderOpenTime() < otime)
                  {
                     eprofit = OrderProfit();
                     otime = OrderOpenTime();
                     eticket = OrderTicket();
                  }
            }
         }
      if ( ptotal < -1*150*nOrders && type == OP_BUY)
         {
            tck=OrderSend(Symbol(),type,0.1,Ask,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()+300*Point,0,Red);
               }
         }
      if (ptotal < -1*150*nOrders && type == OP_SELL)
         {
            tck=OrderSend(Symbol(),type,0.1,Bid,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()-300*Point,0,Red);
               }
         }
      double psince;
      double ps1 = 0;
      double pc;
      for(pos = OrdersHistoryTotal()-1; pos >= 0 ; pos--) 
         OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY);
            {
               if (OrderCloseTime()>otime)
                  {
                     pc = OrderProfit();
                     psince = ps1+pc;
                     ps1 = psince;
                  }
            }
      if (eprofit > -1*(psince+10 && otime+86400<TimeCurrent() && eprofit < 0)
         {
            OrderClose(eticket,0.1,OrderClosePrice(),30,Red);
         }  
 

You can't do this . . .

if (
         OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
          OrderSymbol()== Symbol()  )

. . you need an && or || in there . . probably &&

 
RaptorUK:

You can't do this . . .

. . you need an && or || in there . . probably &&


I did copy paste this part :S. dude, you are awesome :) thank you very much
 

still the very same problem on it when I add it to the ea here is the new code

int start() {
      int nOrders=0;
      double pos;
      double ptotal;
      double pprevious = 0;
      double pnow;
      double eprofit;
      datetime otime;
      int eticket;
      int tck;
      int type;
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
          {
          OrderSelect(pos, SELECT_BY_POS)
            { 
               if (OrderSymbol()== Symbol())
                  {
                     nOrders++;
                  }
            }
          }
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
         {
         OrderSelect(pos, SELECT_BY_POS)
            if (OrderSymbol()== Symbol()
            {
               pnow = OrderProfit();
               ptotal = pnow+pprevious;
               pprevious = ptotal;
               type = OrderType();
               if (OrderOpenTime() < otime)
                  {
                     eprofit = OrderProfit();
                     otime = OrderOpenTime();
                     eticket = OrderTicket();
                  }
            }
         }
      if (ptotal < -1*150*nOrders && type == OP_BUY)
         {
            tck=OrderSend(Symbol(),type,0.1,Ask,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()+300*Point,0,Red);
               }
         }
      if (ptotal < -1*150*nOrders && type == OP_SELL)
         {
            tck=OrderSend(Symbol(),type,0.1,Bid,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()-300*Point,0,Red);
               }
         }
      double psince;
      double ps1 = 0;
      double pc;
      for(pos = OrdersHistoryTotal()-1; pos >= 0 ; pos--) 
         {
         OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY);
            {
               if (OrderCloseTime()>otime)
                  {
                     pc = OrderProfit();
                     psince = ps1+pc;
                     ps1 = psince;
                  }
            }
         }
      if (eprofit > -1*(psince+10 && otime+86400<TimeCurrent() && eprofit < 0)
         {
            OrderClose(eticket,0.1,OrderClosePrice(),30,Red);
         }      
 
 

So I suggested you needed && and so you add {} braces ????

OrderSelect returns true of false so use it as part of your if statement . . .

for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
   if ( OrderSelect(pos, SELECT_BY_POS) &&                // Only my orders w/
        OrderSymbol()== Symbol() )
      {
         nOrders++;
      }
 

I misunderstood you then sorry about that I gie it a try right away sir.

 
liquidd:

I misunderstood you then sorry about that I gie it a try right away sir.

You need to fix all the other instances as well . . .
 
RaptorUK:

So I suggested you needed && and so you add {} braces ????

OrderSelect returns true of false so use it as part of your if statement . . .

here it is with the modification you suggested but still I have the same problem in the code
      int nOrders=0;
      double pos;
      double ptotal;
      double pprevious = 0;
      double pnow;
      double eprofit;
      datetime otime;
      int eticket;
      int tck;
      int type;
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
         {
          if (OrderSelect(pos, SELECT_BY_POS) && OrderSymbol()== Symbol())
                  {
                     nOrders++;
                  }
          }
      for(pos = OrdersTotal()-1; pos >= 0 ; pos--) 
         {
         if (OrderSelect(pos, SELECT_BY_POS) && OrderSymbol()== Symbol())
            {
               pnow = OrderProfit();
               ptotal = pnow+pprevious;
               pprevious = ptotal;
               type = OrderType();
               if (OrderOpenTime() < otime)
                  {
                     eprofit = OrderProfit();
                     otime = OrderOpenTime();
                     eticket = OrderTicket();
                  }
            }
         }
      if (ptotal < -1*150*nOrders && type == OP_BUY)
         {
            tck=OrderSend(Symbol(),type,0.1,Ask,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()+300*Point,0,Red);
               }
         }
      if (ptotal < -1*150*nOrders && type == OP_SELL)
         {
            tck=OrderSend(Symbol(),type,0.1,Bid,30,0,0,NULL,12345,0,Red);
            OrderSelect(tck,SELECT_BY_TICKET,MODE_TRADES);
               {
                  OrderModify(OrderTicket(),OrderClosePrice(),0,OrderOpenPrice()-300*Point,0,Red);
               }
         }
      double psince;
      double ps1 = 0;
      double pc;
      for(pos = OrdersHistoryTotal()-1; pos >= 0 ; pos--) 
         {
         if (OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY) && OrderCloseTime()>otime)
                  {
                     pc = OrderProfit();
                     psince = ps1+pc;
                     ps1 = psince;
                  }
         }
      if (eprofit > -1*(psince+10 && otime+86400<TimeCurrent() && eprofit < 0)
         {
            OrderClose(eticket,0.1,OrderClosePrice(),30,Red);
         }   
 

Check this (

if (eprofit > -1*(psince+10 && otime+86400<TimeCurrent() && eprofit < 0)
 

seem now to be working I'm gonna shoot it to a metatrader see if there are anything that goes wrong.

thank you for helping me trough this you have really been some good help

 
         if (OrderSymbol()== Symbol()
            {
Reason: