"Not all control paths return a value" error - page 3

To add comments, please log in or register
Vitalii Ananev
Vitalii Ananev  
Cristobal Giron:

I do not understand friend

JermyRec points you to a logical error made by you. It is necessary to check whether the order has been selected. The  OrderSelect() function returns true if the order was selected and false if not selected. If you do not do this check, it is possible that the order with the specified ticket does not exist. Then you can get an unpredictable result of your entire function.

int CloseOrder( int ticket, double prce){ 

double price;
int     slippage;
double p = prce;
int     maxtry = RequoteAttempts;
color   CloseColor;

if (!OrderSelect (ticket, SELECT_BY_TICKET , MODE_TRADES )) return(-1); 

int ordtype = OrderType ();
if (ordtype == OP_BUY ) {price = NormalizeDouble ( Bid ,
Keith Watford:

That's a work around, add 1 extra line

Thank you
To add comments, please log in or register