You should never ignore warning messages. They are potential run-time issues.
Always check the return value and act accordingly to catch any possible errors.
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5 / MT4+strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)
You should never ignore warning messages. They are potential run-time issues.
Always check the return value and act accordingly to catch any possible errors.
Thanks guys. Like I mentioned (maybe not clearly enough), OrderModify is returning a value of True. For the heck of it I printed _LastError, which gives me a value of 0.
I just tried
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderTakeProfit(), OrderExpiration());
which is obviously pulling all of the values from the already existing order, and I get the same result.
I'm not sure what else to troubleshoot.
I just tried
which is obviously pulling all of the values from the already existing order, and I get the same result.
I'm not sure what else to troubleshoot.
It does not matter if you expect it to return true or not. You should ALWAYS check the return value and process the condition.
if( OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderTakeProfit(), OrderExpiration() ) { // Success - do something about it } else { // Failed - do something (like reporting the error code) };
It does not matter if you expect it to return true or not. You should ALWAYS check the return value and process the condition.
Oh, I was really confused, but I think I get it now.
The warning message was telling me not that something is wrong, but that it wants to see me checking the outcome of the function. Right?
That took a moment for me to connect the dots! 😂
Thanks!
Good evening.
I do have error handling in the EA, I just didn't realize it wanted me to add it here. Thanks!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, I'm getting this warning message, it's to do with this line:
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 0, OrderExpiration());
My EA is working fine, however, and the function returns a value of True.
Should I ignore the message? Or can I resolve it somehow?