Help Int function

To add comments, please log in or register
David Cunha
25
David Cunha  
Hello,
   I am new to coding and to this forum and am seeking help with the below code: 

Trying to trouble shoot what i did wrong 

I am receiving  the error     'int' - semicolon expected  


Any ideas would be very helpful
thank you 
void OnStart()

int dayoftheweek = DayOfWeek();
bool dayoftheweek() 
{  
     if (dayoftheweek() != 0)
       {return true; }
       
       
       if (dayoftheweek()!= 5)
       {return true;}
       
       
       if (dayoftheweek()!= 6)
       {return true;}
       
      
       return false; 
       }

       


Keith Watford
Moderator
24397
Keith Watford  
void OnStart()

int dayoftheweek = DayOfWeek();
bool dayoftheweek()       

The function must be declared outside of OnStart().

You cannot declare a function within another function.

OnStart() requires {}

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
William Roeder
22403
William Roeder  
void OnStart()   

int dayoftheweek = DayOfWeek();       
bool dayoftheweek() 

You can not define a function inside a function. OnStart has no open, body and closing brace.
To add comments, please log in or register