Closing Pending orders

 
Hi Geniuses,

I'd like to cancel pending orders (which has not been filled, e.g. when OP_BUYSTOP has not been reached).

How can I do that? I don't really care at what price it is closed but I need to know first of all that it is still pending.

Question:
1. I'd like to use OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE). But I don't really care about price, slippage, etc. What shall I use?
2. How can I determine if an order is in fact still PENDING, and not filled? what function can I call to determine that?

Thanks in advance.
 
OrderDelete
 
I've found that I could use OrderDelete() to close/cancel/delete "Pending" orders.

So, I've got one remaining question: how can I determine if an order is "Pending" or "Filled"? I tried looking at OrderProfit(), but it would be 0.000000 for both "Pending" or when it's filled but not yet in profit/loss.

Does anyone know how to determine whether an order is in "Pending" or "Filled" status?
And also, does anyone know how to do OrderClose() at market regardless of having to nominate Price and Slippage?

Thanks again
 
order types: OP_BUYLIMIT, OP_SELLLIMIT, OP_BUYSTOP, OP_SELLSTOP
please see MetaEditor dictionary
 
But Slawa, we can't guarantee that OP_BUYLIMIT, OP_SELLLIMIT, OP_BUYSTOP, OP_SELLSTOP are always "Pending". They may be filled and have a profit or loss.

I am looking at ways to determine whether OP_BUYSTOP is still "Pending" or "Filled".

thank you
 
example please
 
currently EURUSD=1.1796

I put in OP_BUYSTOP at 1.1810. So, at the moment it is not being filled. But let's say that in ten minutes, it goes through 1.1810 and my order is filled.

So, now I have a situation where my OP_BUYSTOP order is no longer a "Pending" order, but a "Filled" order. Hence, I could no longer use OrderDelete() to close the order, right?

So, I just need to find out what do I need to do to ascertain whether my order is still in Pending mode or already filled.
 
i need for example from trade list. only one line, please.
market order (or "filled" as You name it) cannot have types OP_BUYLIMIT, OP_SELLLIMIT, OP_BUYSTOP, OP_SELLSTOP
 
Exponential,
I think that....once a limit or stop order (read: pending order) is filled it then becomes of type OP_BUY or OP_SELL.

IOW, if the order type is OP_BUYLIMIT, OP_SELLLIMIT, OP_BUYSTOP, OP_SELLSTOP then it is still pending.

But if it has been filled, then the order type is going to be OP_BUY or OP_SELL.
 
Thank you GT. And thank you Slawa.

I understand it now!

In addition, Not only that the OrderType() is modifed, the time is also modified to when the fill occurs.

Thank you both once again....
 
:o)
Reason: