Need help on orderselect and ordermodify - MQl 4 Build 625 problem

 

Hi Traders:


I have upgraded my platform to MQl 4 Build 625, however, I am receiving the following error:

return value of 'OrderSelect' should be checked


return value of 'OrderModify' should be checked

double timenow=TimeCurrent();
string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
string servertime=TimeToStr(TimeCurrent(),TIME_SECONDS);
int c=OrdersHistoryTotal( )-1;
OrderSelect(c,SELECT_BY_POS,MODE_HISTORY);
double close=OrderCloseTime();

 
New-Trader:

Hi Traders:


I have upgraded my platform to MQl 4 Build 625, however, I am receiving the following error:

return value of 'OrderSelect' should be checked


return value of 'OrderModify' should be checked

<CODE REMOVED>



Please use the SRC button to post code . . .

Also read this: What are Function return values ? How do I use them ?
 
RaptorUK:
Please use the SRC button to post code . . .

Also read this: What are Function return values ? How do I use them ?


Dear Raptor:

Thank you for your prompt respond. First of all I did use SRC button to post my code. Secondly, I have used ordersend and orderselect in the previous versions without any problem, but, in the new version it gives me error. Thank you for your help on the matter. By the way, I read the link you provided, but, no luck. In fact, as per the link I am supposed to use if but in previous versions I did not use if and it worked.

Thank you in advance for your help.

 
New-Trader:

Hi Traders:


I have upgraded my platform to MQl 4 Build 625, however, I am receiving the following error:

return value of 'OrderSelect' should be checked


return value of 'OrderModify' should be checked

These are warnings and not errors. Anyway, it's better to check the returned value of any function as RaptorUK suggested you. Otherwise how do you know the function do what you are hoping it does ?
 
Thank you for your respond angevoyageur. So, you are saying the EA will work with these warnings as well? if yes, then it is A.OK. However, I am wandering why in the previous version I did not get these warnings?
 
New-Trader:
Thank you for your respond angevoyageur. So, you are saying the EA will work with these warnings as well? if yes, then it is A.OK. However, I am wandering why in the previous version I did not get these warnings?

Because they are newly implemented to invite people not to forget to check the function's returned value.

Even if your code is working, it's poorly coded and not robust.

 
New-Trader:

Dear Raptor:

Thank you for your prompt respond. First of all I did use SRC button to post my code.

No, I'm not sure what you used but it wasn't the SRC button, otherwise it would have looked like this . . .

double timenow=TimeCurrent();
string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
string servertime=TimeToStr(TimeCurrent(),TIME_SECONDS);
int c=OrdersHistoryTotal( )-1;
OrderSelect(c,SELECT_BY_POS,MODE_HISTORY);
double close=OrderCloseTime();

. . . and would not have been present when I quoted your post

 
New-Trader:

Hi Traders:


I have upgraded my platform to MQl 4 Build 625, however, I am receiving the following error:

return value of 'OrderSelect' should be checked


return value of 'OrderModify' should be checked

double timenow=TimeCurrent();
string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
string servertime=TimeToStr(TimeCurrent(),TIME_SECONDS);
int c=OrdersHistoryTotal( )-1;
OrderSelect(c,SELECT_BY_POS,MODE_HISTORY);
double close=OrderCloseTime();


I'm writing an article with this link https://www.mql5.com/en/articles/mt4/_my/1159 and I'm like you and i expect we will get no answer at the end

 

For me now all Ea have such a warning, even standard MACD Sample Ea.

Ea MACD Sample

 
mq704:

For me now all Ea have such a warning, even standard MACD Sample Ea.

Good . . . will eventually mean I can stop harping on about it . . . What are Function return values ? How do I use them ?
 
RaptorUK:
Good . . . will eventually mean I can stop harping on about it . . . What are Function return values ? How do I use them ?


I very much doubt it

Reason: