How do I find out if a pending order has progressed to become a open order

[Deleted]  

Hi,


I am writing a simple script.


The script requires me to make a series of pending orders depending on the previous order being opened.


For example, i made a pending sellstop order #12345. only when this sellstop becomes a market order to sell, then i will make another pending say buystop order.


my question here is how do i know if #12345 has progressed from pending sellstop to sell?


can i use Time() or OrderType()?


Tks for a prompt reply...

 

Hello

yes - you got it! use OrderType() having already done OrderSelect(...)

When a pending order is active it becomes market order and Terminal shows order as OP_BUY||OP_SELL *and not* as OP_BUYLIMIT||OP_SELLLIMIT||OP_BUYSTOP||OP_SELLSTOP

for example:


OrderSelect(...);

int iOrderType = OrderType();
if( OrderCloseTime()==0 && (iOrderType==OP_BUY || iOrderType==OP_SELL) )
{
//is market order
}

and the other way to see if still pending...


OrderSelect(...);

int iOrderType = OrderType();
if( OrderCloseTime() == 0 &&
(iOrderType == OP_BUYLIMIT || iOrderType == OP_BUYSTOP
|| iOrderType == OP_SELLLIMIT || iOrderType == OP_SELLSTOP) )
{
//is pending order
}


have fun!


btw,

could make above snippets into functions() then just call with say ticket# and they return bool or whatever you normally use.

eg,

bool isPendingOrder ( int iTicket ) {...

bool isMarketOrder ( int iTicket ) {...