Download MetaTrader 5

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

To add comments, please log in or register
SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
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.
BigFisherman
125
BigFisherman  
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?

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
int Buy_Ticket = OrderSend(........);

if (Buy_Ticket > 0){
   ....
}
Yes. That one.
BigFisherman
125
BigFisherman  
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.
SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
Using bool can only returns 1 and 0 ... while int can returns more than that. Its that simple.
To add comments, please log in or register