"Unexpected end of program" and "Unbalanced parentheses" Expert Advisor Problem!

 

Hello!


So, I have Expert Advisor that doesn't work and gives me those two errors: "Unexpected end of program" and "Unbalanced Parentheses".

The Problem seems to be where the OnDeinit starts, but somehow whatever thing I try to do, I get more errors that I can't manage to fix...

int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

   double TakeProfit,StopLoss,start_price; 
                                                                                                                    
  
 
nuubsterkill:

Hello!


So, I have Expert Advisor that doesn't work and gives me those two errors: "Unexpected end of program" and "Unbalanced Parentheses".

The Problem seems to be where the OnDeinit starts, but somehow whatever thing I try to do, I get more errors that I can't manage to fix...

You are missing the '}' at the end of OnDeinit
 
Lakshan Perera:
You are missing the '}' at the end of OnDeinit
So it would see like this...
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

   double TakeProfit,StopLoss,start_price; 
                                                                                                                    
  } 
int fun_vol()
{
  if(Volume[0]>1) 
   return 0;     
  else 
   return 1;     
}

Then I get ton of new errors like: '}' - unexpected end of program , 'OnTick' - function already defined and has body, 'OnTick' - function can be declared only in the global scope etc.




 
nuubsterkill:
So it would see like this...

Then I get ton of new errors like: '}' - unexpected end of program , 'OnTick' - function already defined and has body, 'OnTick' - function can be declared only in the global scope etc.





try this,

void OnDeinit(const int reason)
  {}
 

Also, remove '/' in the following function


int fun_touch(int status)
{
  if(status==1)
  {
  if(StopLoss<Bid&&Bid<TakeProfit)  
  return 0;   
  else
  return 1;   
  }
  else if(status==-1)
  {
  if(StopLoss>Ask&&Ask>TakeProfit)
  return 0; 
  else
  return 1;  /
  }
  else return 10;
}
 
Lakshan Perera:


try this,

Thank you :) Had do adjust two other things aswell and got it to run without any errors :)
 
Lakshan Perera:

Also, remove '/' in the following function


Yep, That's what I did :D 
 

Good evening, I do not understand programming I copied this code from another site

but this one giving these errors, somebody could inform me where to find them. thank you.

//    expert start function

//+------------------------------------------------------------------+

int start(){

   double MyPoint=Point;{

  if(Digits==3 || Digits==5) MyPoint=Point*10;

    double TheStopLoss=0;

  double TheTakeProfit=0;

  if( TotalOrdersCount()==0 )

  {

     int result=0;



 
Don't use old threads start a new one. Place your code in code tags. See </> icons in the editor menu.
 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. int start(){                    < Where is the ending bracket for this one?
       double MyPoint=Point;{       < What is that bracket doing there?
    ⋮
      if( TotalOrdersCount()==0 )
      {                             < Where is the ending bracket for this one?
         int result=0;
 

ALGUEM ME AJUDA, eu nao sei o que fazer.
Someone helps me, i dont know what to do.
Files:
indicadoor.JPG  137 kb
inidicador_2.JPG  139 kb
Reason: