MQL4 coding

 

Hi im somewhat new to coding and reached a problem using void ontick() .

 

Before it was simply int Start() , but i want the EA to recalculate after each tick, therefor ontick seems perfect,

however, the return(0) operation is now returning an error of " 'return' - 'void' function returns a value ",  

whilst return() returns error message ')' expression expected...

this has somewhat confounded me, does any one know what it expects of me? 

        if ( OrderType() == OP_SELL && OrderMagicNumber() == 6)
        
        {                
               if(M1_1 < S1_1 && M1_0 >= S1_0)       // ---- Green line crosses red upwards on 4H PERIOD
               {
                  bool res4s;
                  res4s = OrderClose( OrderTicket(), OrderLots(), Ask, 10, Red );
              
                  if (res4s = false)            
                  {
                    _GetLastError = GetLastError();
                    Alert( "Error OrderClose № ", _GetLastError );
                    return(-1);                                
                  }
                     else
                      {
                        Alert ("Sell Order Closed Successfully");
                        //---- if the alert has not changed, quit: it is too early to open a new position
                      }  
                                        
             }
                 //else OrderGetInteger(ORDER_TIME_SETUP);
                // if (TimeCurrent => (ORDER_TIME_SETUP + 4 Hour)) STOPLOSSXS;
                    
                // else Alert ("Problem whilst moving SL to BE");
              
                  
          
        }
        else return ();
 
xanderhinds: , does any one know what it expects of me?
It expects that you have read the documentation. Return Operator - Operators - Language Basics - MQL4 Reference
Return Operator - Operators - Language Basics - MQL4 Reference
Return Operator - Operators - Language Basics - MQL4 Reference
  • docs.mql4.com
Return Operator - Operators - Language Basics - MQL4 Reference
Reason: