What about reading? All you nee you fin in either the Book or Documentation (links are above) or in the editor's reference.
You would have found for order close:
Returned value
Returns true if successful, otherwise false. To get additional error information, one has to call the GetLastError() function.
Gooly - I know that but you missed the point of my query which is the warnings inside from inside void() code which seem to be weird
... instead of trying to discover an America once again ... just do a quick search within previous topics on this forum ...
and surely, you'll be able to find a correct answer to your query ... for example: Loops and Closing or Deleting Orders
BigAl: Is it me or is this just MQL just wierd in this area
if (!OrderClose(MyTicket, OrderLots(), OrderClosePrice(), 3, Blue)) return(-1); | It's you. How can a void function return a value? You have:void funtion(){ ... return(-1); ... }What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles |
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
When coding within a void?
If i use the code:
OrderClose(MyTicket, OrderLots(), OrderClosePrice(), 3, Blue);
On compilation I get a warning "return value of 'OrderClose' should be checked"
If i use the code:
if (!OrderClose(MyTicket, OrderLots(), OrderClosePrice(), 3, Blue)) return(-1);
On compilation I get a warning "'void' function returns a value"
But if I use the code:
Result = OrderClose(MyTicket, OrderLots(), OrderClosePrice(), 3, Blue);
Then I get no warnings but have a variable "Result" that is of no use to me at all as I have no idea what it contains
Is it me or is this just MQL just wierd in this area