Pending order execution

 

Hi,

I am placing buystop\sellstop order and want to modify their sp\tl. For this i want to check whether my pending are order are filled or not so that i can specify tp\sl value. How can i check pending order execution ?

i am using following lines of code but it is not really working ...

Thanks

bool order = OrderSelect(0,SELECT_BY_POS);
int orderTk = OrderTicket();
if(OrderType() == OP_BUYSTOP && OrderOpenPrice()!=0)
{
//modify order
}
 
bugs09:

Hi,

I am placing buystop\sellstop order and want to modify their sp\tl. For this i want to check whether my pending are order are filled or not so that i can specify tp\sl value. How can i check pending order execution ?

i am using following lines of code but it is not really working ...

Thanks


What moment did you start coding ??

How many trades did you place ???

Are there situations you have several trades open ??

If so then why not check other trades ??

 
bool order = OrderSelect(0,SELECT_BY_POS);
int orderTk = OrderTicket();
if(OrderType() == OP_BUYSTOP && OrderOpenPrice()!=0)
{
//modify order
}
  1. If the OrderSelect fails everything after is bogus. What are Function return values ? How do I use them ? - MQL4 forum
  2. You can't open a pending order with a zero price. OrderOpenPrice() will ALWAYS be non-zero.
  3. If the order has opened, it is no longer a pending order. OrderType will change from OP_BUYSTOP to OP_BUY.
  4. Why aren't you using a OrderSelect loop to find ALL open orders and filter with your pair and magic number so your code is compatible with every other EA and manual trading?
 
deVries:


What moment did you start coding ??

How many trades did you place ???

Are there situations you have several trades open ??

If so then why not check other trades ??

No,i have just one trade either buystop or sellstop at a time.
 
WHRoeder:
  1. If the OrderSelect fails everything after is bogus. What are Function return values ? How do I use them ? - MQL4 forum
  2. You can't open a pending order with a zero price. OrderOpenPrice() will ALWAYS be non-zero.
  3. If the order has opened, it is no longer a pending order. OrderType will change from OP_BUYSTOP to OP_BUY.
  4. Why aren't you using a OrderSelect loop to find ALL open orders and filter with your pair and magic number so your code is compatible with every other EA and manual trading?

Thanks i got my answer.