Communications Script Debugging

 

Hello All,

 Just wanted to ask if there is any one willing to help me solve the following issue(I'm still a novice coder). When I compile my code, the following snipbit of code throws out 3 errors as indicated. 


void Comms()
{
while(IsTradeAllowed() == true)
   {                                                                                                                                   
   if(InitiateComms == true)(Sleep(CommsTime*100*PeriodSeconds()))
   {                                                                                                                                       -> Some operator expected
   SendMail("Looper_BA1",                                                                                                    -> Constant expression required
          "n/Balance =" + DoubleToString(AccountBalance(),8) + 
          "n/Total Balance Growth" + DoubleToString((AccountBalance() - StartBalance),8) +
          "n/Equity" + DoubleToString(AccountEquity()) +
          "n/Total Balance Growth" + DoubleToString((AccountEquity() - StartEquity),8)) ;               ->  Unexpected token  
   }
   }

}

Please help me sort out these issues,

Regards. 

 

This is the line that is causing you problems:

if(InitiateComms == true)(Sleep(CommsTime*100*PeriodSeconds()))

I *think* this is what you want: 

void Comms()
{
while(IsTradeAllowed() == true)
   {                                                                                                                                  
   if(InitiateComms == true)
   {                                                                                                                                    
   Sleep(CommsTime*100*PeriodSeconds());
   SendMail("Looper_BA1",                                                                                                    
          "n/Balance =" + DoubleToString(AccountBalance(),8) +
          "n/Total Balance Growth" + DoubleToString((AccountBalance() - StartBalance),8) +
          "n/Equity" + DoubleToString(AccountEquity()) +
          "n/Total Balance Growth" + DoubleToString((AccountEquity() - StartEquity),8)) ;                
   }
   }
}
 
honest_knave:

This is the line that is causing you problems:

if(InitiateComms == true)(Sleep(CommsTime*100*PeriodSeconds()))

I *think* this is what you want: 

void Comms()
{
while(IsTradeAllowed() == true)
   {                                                                                                                                  
   if(InitiateComms == true)
   {                                                                                                                                    
   Sleep(CommsTime*100*PeriodSeconds());
   SendMail("Looper_BA1",                                                                                                    
          "n/Balance =" + DoubleToString(AccountBalance(),8) +
          "n/Total Balance Growth" + DoubleToString((AccountBalance() - StartBalance),8) +
          "n/Equity" + DoubleToString(AccountEquity()) +
          "n/Total Balance Growth" + DoubleToString((AccountEquity() - StartEquity),8)) ;                
   }
   }
}

Hello Honest_knave,

 

Thank you for your assistance! Your recommendation has eliminated two of my errors, the only one that remains is the " 'SendMail' - Some operator expected".

Any recommendations?

Regards, 

 
GK0135:

Hello Honest_knave,

 

Thank you for your assistance! Your recommendation has eliminated two of my errors, the only one that remains is the " 'SendMail' - Some operator expected".

Any recommendations?

Regards, 

I think you missed the ; at the end of the Sleep line?
 
honest_knave: I think you missed the ; at the end of the Sleep line?
That plus the fact that OP's using parentheses instead of braces
Reason: