Code fails to compile ('\end_of_program' - unbalanced left parenthesis)

 

Please I need with the below lines of mql4 codes. It fails to compile and returns the error "'\end_of_program' - unbalanced left parenthesis".



//--- input parameters
extern int WhenToStartTrailing=60;
extern int PipsToTrail=10;
double Rhigh ;
double Rlow ;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
for (int i=OrdersTotal()-1; i>=0; i--)

int CurrentTime = TimeHour(TimeCurrent());
int OpenTime = TimeHour(OrderOpenTime());
int count = CurrentTime - OpenTime

{
OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
if(Period()==PERIOD_H1)
if(OrderType==OP_BUY)
{
Rhigh=High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0];
if(Rhigh-OrderOpenPrice >= (WhenToStartTrailing*Point))
if((Low[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0]-(PipsToTrail*Point)) > OrderStopLoss)
OrderModify(OrderTicket(),OrderOpenPrice(),Low[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count,0]-(PipsToTrail*Point),OrderTakeProfit(),0,CLR_NONE);
return(0);
}
if(OrderType==OP_SELL)
{
Rlow=Low[iLowest(Symbol(),PERIOD_H1,MODE_LOW,count(),0];
if(OrderOpenPrice-Rlow >= WhenToStartTrailing*Point)
if((High[iLowest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0]+(PipsToTrail*Point) < OrderStopLoss)|| OrderStopLoss = 0)
OrderModify(OrderTicket(),OrderOpenPrice(),High[iLowest(Symbol(),PERIOD_H1,MODE_HIGH,count,0]+(PipsToTrail*Point),OrderTakeProfit(),0,CLR_NONE);
return(0);
}



return(0);

}

 
//+------------------------------------------------------------------+
//|                                                Smart Trailer.mq4 |
//|                                                          Echelon |
//|                                               ebukaume@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Echelon"
#property link      "ebukaume@gmail.com"

//--- input parameters
extern int       WhenToStartTrailing=60;
extern int       PipsToTrail=10;
double Rhigh   ;  
double Rlow    ;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   for (int i=OrdersTotal()-1; i>=0; i--)
   
      int CurrentTime = TimeHour(TimeCurrent());
      int OpenTime = TimeHour(OrderOpenTime());
      int count = CurrentTime - OpenTime  
   
      {
        OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
        if(OrderSymbol()==Symbol())
        if(Period()==PERIOD_H1)
        if(OrderType()==OP_BUY)
         {
            Rhigh=High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0];
            if(Rhigh-OrderOpenPrice >= (WhenToStartTrailing*Point))
            if((Low[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0]-(PipsToTrail*Point)) > OrderStopLoss)
            OrderModify(OrderTicket(),OrderOpenPrice(),Low[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count,0]-(PipsToTrail*Point),OrderTakeProfit(),0,CLR_NONE);
        
            }
        if(OrderType()==OP_SELL)
         {
            Rlow=Low[iLowest(Symbol(),PERIOD_H1,MODE_LOW,count(),0]
            if(OrderOpenPrice-Rlow >= WhenToStartTrailing*Point)
            if((High[iLowest(Symbol(),PERIOD_H1,MODE_HIGH,count(),0]+(PipsToTrail*Point) < OrderStopLoss)|| OrderStopLoss = 0)
            OrderModify(OrderTicket(),OrderOpenPrice(),High[iLowest(Symbol(),PERIOD_H1,MODE_HIGH,count,0]+(PipsToTrail*Point),OrderTakeProfit(),0,CLR_NONE);
          }
     }        

return(0)
}

//+------------------------------------------------------------------+
 
ebukaume: It fails to compile and returns the error "'\end_of_program' - unbalanced left parenthesis".

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.
    You reposted while I was replying. Why didn't you EDIT your original post.
  2. for (int i=OrdersTotal()-1; i>=0; i--)
       int CurrentTime = TimeHour(TimeCurrent());
    
    int OpenTime = TimeHour(OrderOpenTime());
    int count = CurrentTime - OpenTime
    {
    OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
    
    Why are you getting the TimeCurrent multiple times in a for loop?
  3. Why is there a brace ("{") not connected to something?
  4. The for loop has ended, (i == -1) so the OrderSelect will ALWAYS fail.
  5. What are Function return values ? How do I use them ? - MQL4 forum
  6. OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
    if(OrderSymbol()==Symbol())
    if(Period()==PERIOD_H1)
    if(OrderType==OP_BUY)
    {
       Rhigh=..
       if(Rhigh-
       if((Low[i
           OrderModify(OrderTi
       return(0);
    }
    if(OrderType==OP_SELL)
    {
    You check if the selected order is the chart symbol, and EA is on the H1, and the type is a buy before modifying. This means you modify ALL buy orders for the current symbol, but you modify ALL sell orders. Incompatible with every other EA and manual trading. Learn to use magic numbers. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
  7. Rhigh=High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH, count(), 0];
              1        2?     33                           33 2?1 unbalanced left parenthesis 2
  8. OrderModify(OrderTicket(), OrderOpenPrice(),
               1           22                22 
                 Low[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,count,0]-(PipsToTrail*Point),
                    3        4?     55                        4?  3 2                 2
                OrderTakeProfit(),0,CLR_NONE);
                               22           1   // unbalanced left parenthesis 4




Reason: