Download MetaTrader 5

Compiling errors: variables expected or not defined, global scope

To add comments, please log in or register
zeno
275
zeno  

Hello,

While I try to compile the mq4 file, I receive various errors. I attach the corresponding txt file 'research 5 - chart 2 red lines ETI.txt'.

I looked up on compiling errors, but could not see an answer. 

I have following errors and warnings:

* 'ObjectCreate' - variable expected (11, 6)

* 'int' - variable expected (11, 32)

* 'type' - expression on global scope not allowed (11, 36)

* 'type' - variable not defined (11, 36)

* 'datetime' - variable expected (11, 54), (12,34), (13,19)

* 'time1' - expression on global scope not allowed (11, 63)

'time2' - expression on global scope not allowed (12, 43) 

'time3' - expression on global scope not allowed (13, 28)  

* ')' - comma or semicolon expected (13, 52)

* '{' - expression on global scope not allowed (16, 1)

 

It seems to me that various of these messages contain 'standard MT4' expressions. 

Thank you for your help. 

whroeder1
16274
whroeder1  
  1. There is no function definition. Where is the highlighted portion?
    bool ObjectCreate(string name, int type, int window, datetime time1, 
                      double price1, datetime time2=0,double price2=0, 
                      datetime time3=0, double price3=0)
    { ... return(something); }

  2. All code must be inside a function
    int start(){
     :
     if(ObjectCreate(/* arguments */)==false)
    {
       // an error occurred, its code should be recorded into a journal
       Print("Error of calling ObjectCreate():",GetLastError());
    }
    :

  3. Where is the code
    if(ObjectCreate(/* arguments */)==false)
    

tasaoirse
33
tasaoirse  

Helo,can anyone help me out..whn i trued to run the code " i m getting too many errors "unexpected error & unbalanced parantheses"..could any plz correct the code & send me ="tasaoirse@gmail.com"

 

int start()

{

CheckBollingerBandTrade();

 

return(0); 

 

 

void CheckBollingerBandTrade(); 

double LowerBB=iBands(NULL,0,20,2,0,0,MODE_LOWER,1);

double UpperBB=iBands(NULL,0,20,2,0,0,MODE_HIGH,1);


double PrevLowerBB=iBands(NULL,0,BollingerBandsPeriod,BollingerBandsDeviation,0,0,MODE_LOWER,5);

double PrevUpperBB=iBands(NULL,0,BollingerBandsPeriod,BollingerBandsDeviation,0,0,MODE_HIGH,5);



if((Low[1]>LowerBB) &&  (Low[2]<PrevLowerBB))

if(CheckOpenOrders==0){

int BuyTicket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,(Ask+0.0010),NULL,MagicNumber,0,0,Blue);

}

if((High[1]<UpperBB) && (High[2]>PrevUpperBB))

if(CheckOpenOrders==0){

int SellTicket=OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,(Bid-0.0010),NULL,MagicNumber,0,0,Red);

}


///////////////////

 

int CheckOpenOrders();

{

for(int i=0;i<OrdersTotal();i++){

       if OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true){

             if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderType==OP_BUY)

                  BuyOpenOrdersCheck++;

               }

             }

             


int SellOpenOrderCheck();

  for (int i=0; i<OrdersTotal(); i++) {                                               

        if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true) {

          if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() == OP_SELL )

             SellOpenOrdersCheck++;

              }

           

           }


return(0);

}

peter.MT4Web
157
peter.MT4Web  

Start with "how to code a function"

  Where to put a ";"

  How to use "{" and " }" for the body.


Learn the basics before starting to code an EA.

To add comments, please log in or register