Alert: MT4 Terminal Duplicating Orders Sent by Experts - page 7

 
bool Buy_Ticket = OrderSend(........) > 0;


I use int to declare

int Buy_Ticket;
and anything returns not positive, always considered failed. It is because we want to get the ticket number, not bool statement.
 
deysmacro:


I use int to declare

and anything returns not positive, always considered failed. It is because we want to get the ticket number, not bool statement.



What do you mean by anything returns not positive? The logic behind my original coding with:

 bool Buy_Ticket = OrderSend(........) > 0;

 if (Buy_Ticket){
    ...
 }

was that all successful OrderSend() should return ticket no. > 0, thus bool Buy_Ticket will be true. To my understanding, it's basically the same treatment as:

int Buy_Ticket = OrderSend(........);

if (Buy_Ticket > 0){
   ....
}


Is that what you're trying to say?

 
int Buy_Ticket = OrderSend(........);

if (Buy_Ticket > 0){
   ....
}
Yes. That one.
 
deysmacro:
Yes. That one.

IMO both method stated in my previous post works the same, as supported by my test results here. However I'm still learning to how code better while working on my trading skills.
 
Using bool can only returns 1 and 0 ... while int can returns more than that. Its that simple.