OrderDelete Function or the broker issue

 

Greeting to all, recently I had this error from OrderDelete Function...

"xxxxxxx : unknown ticket xxxxxx for OrderDelete Function"

This error appears every 1-2 min in my experts log...

Initially, I thought i have created an infinity loop that caused this...

So, I modified my codes to use a 3 trial for-loop...

But, still i got this error... What surprising me is that even i turn off the EA, this error still appear every 1-2 mins...

To solve this, i have to closed off the MT4 and relaunch it...

My question is "is this a coding issue or a broker issue"?

 
baiwan:

Greeting to all, recently I had this error from OrderDelete Function...

"xxxxxxx : unknown ticket xxxxxx for OrderDelete Function"

This error appears every 1-2 min in my experts log...

Initially, I thought i have created an infinity loop that caused this...

So, I modified my codes to use a 3 trial for-loop...

But, still i got this error... What surprising me is that even i turn off the EA, this error still appear every 1-2 mins...

To solve this, i have to closed off the MT4 and relaunch it...

My question is "is this a coding issue or a broker issue"?

It is a coding issue
 

First, use GetLastError() to determine what kind of error it is.

Second, remember that OrderDelete is used to delete pending orders. Once an pending order becomes an open (market) order, you must use OrderClose to close the order. Also, if you attempt to use OrderDelete or OrderClose on an order that was closed because it hit the stoploss or takeprofit (or it was previously deleted/closed), then you would get an "unknown ticket number" error.

Reason: