I do not see what it is you are seeing but ;) I will promptly include the GetLastOrder() function to shed some illumination on this issue. Apologies for posting a question without first including the GetLastOrder() function with the code.
Thank you.
What ticket number does OrderPrint() show ? what error is shown ?
The OrderClose() function is attempting to close ticket number 2.
USDJPY ticket number is 20526942 and it's position number in the pool is 2.
If my understanding is correct, The OrderClose() function cannot close the USDJPY order because the first OrderClose() function parameter is using position number 2 instead of the "unique number of the order ticket" (20526942). If you confirm this statement, then I it seems I must find a way to isolate the ticket number 20526942 of the USDJPY order, then place this number in the OrderClose() function's first parameter.
If my understanding is correct, The OrderClose() function cannot close the USDJPY order because the first OrderClose() function parameter is using position number 2 instead of the "unique number of the order ticket" (20526942). If you confirm this statement, then I it seems I must find a way to isolate the ticket number 20526942 of the USDJPY order, then place this number in the OrderClose() function's first parameter.
What say you to this? ;)
Yup, and there is a function to do just that . . .
Once again, I am so, so abundantly blessed to receive yet another more than generous contribution from the 'Experts' tab in my MetaTrader which I greet with open arms and an exceedingly joyous manifestation. ;)
Once again, I am so, so blessed to receive yet another generous contribution from the 'Experts' tab in my MetaTrader which I greet with open arms and an exceedingly joyous manifestation. ;)
Now you need you error reporting so you know exactly what error was generated . . . it's probably that price is too close to SL or TP to close the order. What is your FreezeLevel ?
Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed.
I do not know what the freeze level is for the MetaTrader broker I use to run tests. I assume the freeze level varies by broker.
Do you know of a way I can use to discover the MetaEditor freeze level using the MarketInfo() function?
I have already incorporated the GetLastError() function to no avail. I am trying to place it in the correct location at this time.
Also, the current price of the order should well exceed the freeze level.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Simon,
I do not see what it is you are seeing but ;) I will promptly include the GetLastOrder() function to shed some illumination on this issue. Apologies for posting a question without first including the GetLastOrder() function with the code.
Thank you.
Simon,
what error is shown ?
unknown ticket 2 for OrderClose function
What ticket number does OrderPrint() show ?
#20526942 2012.12.24 13:43 buy 0.01 USDJPY 84.466 0.000 0.000 86.105 0.00 0.00 19.03 0
Thank you.
Simon,
USDJPY ticket number is 20526942.
The OrderClose() function is attempting to close ticket number 2.
USDJPY ticket number is 20526942 and it's position number in the pool is 2.
If my understanding is correct, The OrderClose() function cannot close the USDJPY order because the first OrderClose() function parameter is using position number 2 instead of the "unique number of the order ticket" (20526942). If you confirm this statement, then I it seems I must find a way to isolate the ticket number 20526942 of the USDJPY order, then place this number in the OrderClose() function's first parameter.
What say you to this? ;)
Thank you.
If my understanding is correct, The OrderClose() function cannot close the USDJPY order because the first OrderClose() function parameter is using position number 2 instead of the "unique number of the order ticket" (20526942). If you confirm this statement, then I it seems I must find a way to isolate the ticket number 20526942 of the USDJPY order, then place this number in the OrderClose() function's first parameter.
What say you to this? ;)
Simon,
Ya' don't say? ;)
It couldn't possibly be the inconspicuous OrderTicket() function could it? Hahaha.
Thank you.Simon,
Ya' don't say? ;)
It couldn't possibly be the inconspicuous OrderTicket() function would it? Hahaha.
Thank you.Simon,
Once again, I am so, so abundantly blessed to receive yet another more than generous contribution from the 'Experts' tab in my MetaTrader which I greet with open arms and an exceedingly joyous manifestation. ;)
Error description:
Thank you.
Simon,
Once again, I am so, so blessed to receive yet another generous contribution from the 'Experts' tab in my MetaTrader which I greet with open arms and an exceedingly joyous manifestation. ;)
Simon,
I do not know what the freeze level is for the MetaTrader broker I use to run tests. I assume the freeze level varies by broker.
Do you know of a way I can use to discover the MetaEditor freeze level using the MarketInfo() function?
I have already incorporated the GetLastError() function to no avail. I am trying to place it in the correct location at this time.
Also, the current price of the order should well exceed the freeze level.
Here is a snapshot showing its status:
Thank you.