fail to compile

 

where were my problems ? 


#include <stdlib.mqh> 



/* External variables*/
extern double EquityPercent;
extern double StopLoss;
extern double TakeProfit;
extern int Slippage;
extern int MagicNumber;
extern bool CheckOncePerBar = true;

/*Global*/ 
int BuyTicket;
int SellTicket;
double UsePoint;
int UseSlippage;
datetime CurrentTimeStamp;
double SUM;
double LotSize = 5;

int deinit()
  {
  
   return(0);
  }

int start()
{  

                /* Execute on bar open*/
                if(CheckOncePerBar == true)
             {
                                int BarShift = 1;
                                if(CurrentTimeStamp != Time[0]) 
                                        {
                                                CurrentTimeStamp = Time[0];
                                        bool NewBar = true;
                                        }
                                else NewBar = false;
                        }
                else 
                        {
                                NewBar = true;
                                BarShift = 0;
                } 
                
                        /*Exp Moving Avg*/
                        double EMA = iMA(NULL,0,20,0,MODE_EMA,0,BarShift);
                        double LastEMA = iMA(NULL,0,20,0,MODE_EMA,0,BarShift+1);
                        
          /*Calculate StopLoss*/
        int CountBars = 4;
        int LowestShift = iLowest(NULL,0,MODE_LOW,CountBars,0);
        double StopLoss = Low[LowestShift];
        
        /*Calculate TakePorfit*/
         int CountBars1 = 9;
        int HighestShift = iHighest(NULL,0,MODE_HIGH,CountBars1,0);
        double TakeProfit = High[HighestShift];
        
                   /*risk menager*/
         double profit = TakeProfit - Bid ;
         double lose = Ask - StopLoss;
         SUM = lose / profit;           
         
                /* Begin trade block*/
                if(NewBar == true && SUM <= 0.8)
        
                        {   
                
                                /* Buy order*/ 
                                if(((((x) || x) && x) && BuyMarketCount(Symbol(),MagicNumber) == 0) //i censor the method
                                        {
                                                /* Close sell orders*/
                                                if(SellMarketCount(Symbol(),MagicNumber) > 0)
                                                        { 
                                                                CloseAllSellOrders(Symbol(),MagicNumber,Slippage);
                                                        }

                                                /* Open buy order*/
                                                BuyTicket = OpenBuyOrder(Symbol(),LotSize,UseSlippage,MagicNumber);
                                        
                                                /* Order modification*/
                                                if(BuyTicket > 0 && (StopLoss > 0 || TakeProfit > 0))
                                                        {
                                                                OrderSelect(BuyTicket,SELECT_BY_TICKET);
                                                                double OpenPrice = OrderOpenPrice();
                                
                                                                /* Calculate and verify stop loss and take profit*/
                                                                double BuyStopLoss = CalcBuyStopLoss(Symbol(),StopLoss,OpenPrice);
                                                                if(BuyStopLoss > 0) BuyStopLoss = AdjustBelowStopLevel(Symbol(),BuyStopLoss,1);
                                        
                                                                double BuyTakeProfit = CalcBuyTakeProfit(Symbol(),TakeProfit,OpenPrice);
                                                                if(BuyTakeProfit > 0) BuyTakeProfit = AdjustAboveStopLevel(Symbol(),BuyTakeProfit,1);
                                        
                                                                /* Add stop loss and take profit*/
                                                                AddStopProfit(BuyTicket,BuyStopLoss,BuyTakeProfit);
                                                  }  
                                        }
                                        else break;
                                }       
                                return(0);
}

'\end_of_program' - unbalanced left parenthesis C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (112, 2)

 

this is my first EA , 

how i cancleing the SL OR TP when one of the command has been filled ?  

thanks :) 

 
vushel:

where were my problems ? 


'\end_of_program' - unbalanced left parenthesis C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (112, 2)

 

this is my first EA , 

thanks :) 


                  if(((((x) || x) && x) && BuyMarketCount(Symbol(),MagicNumber) == 0) //i censor the method

must be

                  if((((x) || x) && x) && BuyMarketCount(Symbol(),MagicNumber) == 0) //i censor the method
and x is not defined
 
angevoyageur:

must be

and x is not defined


if i delete '(' the the compilor showes me thos errors  : 

Compiling 'My Expert Advisor.mq4'...    
'BuyMarketCount' - function is not defined      C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (81, 102)
'SellMarketCount' - function is not defined     C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (84, 10)
'CloseAllSellOrders' - function is not defined  C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (86, 9)
'OpenBuyOrder' - function is not defined        C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (90, 19)
'CalcBuyStopLoss' - function is not defined     C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (99, 30)
'AdjustBelowStopLevel' - function is not defined        C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (100, 43)
'CalcBuyTakeProfit' - function is not defined   C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (102, 32)
'AdjustAboveStopLevel' - function is not defined        C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (103, 47)
'AddStopProfit' - function is not defined       C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (106, 9)
'else' - unexpected token       C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (109, 6)
'break' - 'break' or 'continue' used within some cycle only     C:\Program Files (x86)\MetaTrader 4\experts\My Expert Advisor.mq4 (109, 11)
11 error(s), 0 warning(s)       
 
vushel:


if i delete '(' the the compilor showes me thos errors  : 

Yes,  you need to fix them.  How can you call a function that doesn't exist in your code ?  and that you haven't included ? 
Reason: