Open parenthesis expected

 

I'm getting this error with this piece of code:

double StopLoss=NormalizeDouble(OrderGetDouble(ORDER_PRICE_OPEN)-(OrderGetDouble(ORDER_TP)-OrderGetDouble(ORDER_PRICE_OPEN))*(AutoStopLoss/100),Digits);

But I don't see the mistake, anyone can help?

 
David Diez:

I'm getting this error with this piece of code:

But I don't see the mistake, anyone can help?

You're using Digits as a function but without the parameter parentheses. You can use either Digits() or _Digits to get the number of decimal digits determining the accuracy of price of the current chart symbol.

 
coldseed:

You're using Digits as a function but without the parameter parentheses. You can use either Digits() or _Digits to get the number of decimal digits determining the accuracy of price of the current chart symbol.

Ok, I solved but thank you for your reply.
 
David Diez: But I don't see the mistake, anyone can help?

Of course you can't. Make your code readable.

Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Don't copy and paste code, write self documenting code.

   double OP = OrderGetDouble(ORDER_PRICE_OPEN);
   double TP = OrderGetDouble(ORDER_TP);
   double SL = OP-(TP-OP)*(AutoStopLoss/100);
double StopLoss=NormalizeDouble(SL,Digits);
With that you know the problem is only the last line and can see the column with the error.
 
whroeder1:

Of course you can't. Make your code readable.

Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Don't copy and paste code, write self documenting code.

With that you know the problem is only the last line and can see the column with the error.
Thank you for your reply.
 
'if' - open parenthesis expected SMART TREADER.mq4 47 3

 please I'm getting this error in my code yet I can't find where the error is from.


 {

  double  biggerMa = iMA(_Symbol,PERIOD_CURRENT,50,0,MODE_SMA,0,1);

  

  double smallerMa = iMA(_Symbol,PERIOD_CURRENT,20,0,MODE_EMA,0,1);

  

   

  if smallerMa > biggerMa {Print(OrderOpenPrice)} 

  else

   {Print(OrderClose < smallerMa)};

  

  if smallerMa < biggerMa {Print(OrderOpenPrice)}

  else

   {Print(OrderClose > smallerMa)};


     double  OrderOpenPrice();

 

  if(OrderSelect(10, SELECT_BY_POS)==true) 

    Print("open price for the order 10 ",OrderOpenPrice()); 

  else 

    Print("OrderSelect returned the error of ",GetLastError());

  

my code
 
Sir Kewaco #:
'if' - open parenthesis expected SMART TREADER.mq4 47 3

 please I'm getting this error in my code yet I can't find where the error is from.

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file. If you can figure out what is wrong with line 43. Post your code.


     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

 
hi everyone , still newbie in coding so please be nice :)
i have 2 error and 2 warning in my code that  i don't know how to fix it after different approch (using different fonction ...)
can someone help ?

2 erreurs
 ',' - open parenthesis expected EA-time-Bomb.mq5 43 47
here is the line 43: sl = NormalizeDouble(price - StopLoss*Point, precision);

 ',' - open parenthesis expected EA-time-Bomb.mq5 44 49
line 44: tp = NormalizeDouble(price + TakeProfit*Point, precision);

 2 warnings
 return value of 'OrderSend' should be checked EA-time-Bomb.mq5 58 4
line 58: OrderSend(request, result);

 variable 'ticket' not used EA-time-Bomb.mq5 37 8
line 37: int ticket;
 
jyh28 #: hi everyone , still newbie in coding so please be nice :) i have 2 error and 2 warning in my code that  i don't know how to fix it after different approch (using different fonction ...) can someone help ?

Always show all relevant code. Also show the error log and identify the lines with the errors.

However, if your code was generated with ChatGPT, then we can't help you.

 
Fernando Carreiro #:

Always show all relevant code. Also show the error log and identify the lines with the errors.

However, if your code was generated with ChatGPT, then we can't help you.

interesting comment, why can't help if gpt generated the code ?

 
@jyh28 #:interesting comment, why can't help if gpt generated the code ?

Because ChatGPT produces horrible code, mixing MQL4 and MQL5 and mixing EA with Indicator code. The result is a mess that cannot be fixed.

Also, since you don't know how code, you will not understand the advice given, nor will you know how to apply it.

So, either learn to code or hire a "human" to code it for you.

Reason: