How to fix it ? expression not boolean Line 15

 
1 bool BreakEven(int MN){
2 int Ticket;

3

4  

5 for(int i = OrdersTotal() - 1; i >= 0; i--) {
6    if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES))continue;
7
8    if(OrderSymbol() == Symbol() && OrderMagicNumber() == MN){
9      Ticket = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Green);
10      if(Ticket < 0) Print("Error in Break Even : ", GetLastError());
11       break;
12      }
13    }
14
15  return (Ticket);

16 }


** if compile : appear description expression not boolean Line 15

 
// return >0 : ticket modified
//        =0 : nothing found
//        <0 : error
int BreakEven(int MN)
 {
   int Ticket=0; 
 

ok thanks


nice solution...

 
  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.  bool BreakEven(int MN){
      int Ticket;
      return (Ticket); 
    Your function returns a boolean. A ticket is not. Either change its return type or return a bool. Which depends on the calling code.

  3. Ticket = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Green);
    if(Ticket < 0) Print("Error in Break Even : ", GetLastError()); 
    Perhaps you should read the manual. OrderModify does not return a ticket.

  4. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

 
ok im sorry, i just read this message