function definition unexpected, Help

 

Hello to all

I have eliminated all errors and warnings : ) with exception of the "function definition unexpected" grrrrrr

Have a look at the code and see if you can resolve. The problem is where the code shows the 'int deinit ()'

Thanks very much for having a look.

Regards Huckleberry

//--- input parameters
#define MAGICMA 20110717

extern double    dPips=10.0;
extern double    MaximumRisk = 0.1;
extern double    OurLots = 0.1;
extern int       iBaseBar = 1;
extern int       iPrior = 20;
extern int       iSlippage = 3;
extern double    dOurTrail = 20;
extern double    dOurCircus = 10;
extern int       iWeTrade = 1;
extern int       iWePivot = 1;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   if (Bars < 1000)
   {
   Print ("Bars number Less then 1000");
   return(0);
  }
  }
  
//---------
                                   
int CalculateCurrentWorkingOrders(string symbol)
  {
   int buys=0,sells=0;
//----
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
        {
         if(OrderType()==OP_BUY)  buys++;
          Print ("First Buy Entry");
        if(OrderType()==OP_SELL) sells++;
          Print ("First Sell Entry");
        }
     }
     
//---- return total orders 

   if(buys>0) return(buys)   ;
   else       return(-sells) ;
  }
  //---Calculates and prints Total working Entries
  
  //----

void Time2Open?()
  {
  
//--------------Buy Conditions------------//

   int FirstBuyEntry;  
   double dHighest = High   [ iHighest ( 0 , 0    , MODE_HIGH ,  
                                   iPrior , iBaseBar           ) ]   ;
if ( Ask > dHighest )
{
FirstBuyEntry = OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue);
      return;
}      
                                    
//---------------Sell Conditions----------// 

   int FirstSellEntry; 
   double dLowest  = Low    [ iLowest  ( 0 , 0    , MODE_LOW  ,   
                                   iPrior , iBaseBar           ) ]   ;
if ( Bid < dLowest )
{
FirstSellEntry = OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
return;
}

//--------------- 
                                                                        
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() 
  {
//----
Alert   ( ""               , "Stop "  , UninitializeReason () ) ; 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

void start()
  {
//---- check for history and trading
   if(Bars<100 || IsTradeAllowed()==false) return;
//---- calculate open orders by current symbol
   if(CalculateCurrentWorkingOrders(Symbol())==0) Time2Open? ()  ;
   else                                           Time2Close?()  ;
//----
  }
 

Where is your closing brace ( } ) for function . .

void Time2Open?()
  {

the cause of an error is not always where the effect is found . . .

 

fixed it and cleaned it up...

and of course, as they say, every answer creates two new questions...

Files:
huck.mq4  3 kb
 

Found the area for closing brace with your help. Thank you both. This site is great.

Regards Huckleberry

Reason: