How to know when an order is modified?

 

Hello there guys,

I want to know if there is any way to find our when an order is modified? I mean is there any flag or trigger that is activated when an order is modified? I need to know when any order in my terminal is updated.

Thanking in advance.

Regards,

Umer

 
Master.Aurora:

Hello there guys,

I want to know if there is any way to find our when an order is modified?

No, there isn't. If you want to know this info you have to track it . . . manually.
 

Thank you for your response.

What solution would you suggest?

Thanx,
Umer

 
Master.Aurora:

Thank you for your response.

What solution would you suggest?

Thanx,
Umer

Keep track of all the order info and then you will note when anything changes . . . . it's a little hard to make a more valuable comment without knowing exactly what yo are trying to achieve.
 
Master.Aurora:
I need to know when any order in my terminal is updated.
You'll have to check each tick
int         tickets[],  types[];
double      lots[],     OOPs[],     OOTs[],     OSLs[],     OTPs;
datetime    exprs[];
void RememberNew(int iPos = -1){
    if (iPos == -1){
        int nPrev = ArraySize(tickets),
        for(iPos = 0; iPos < nPrev; iPos++) if (tickets[iPos] == 0) break;
        if (iPos == nPrev){ // No free slot, make one.
            ArrayResize(tickets,    nPrev+1);   ArrayResize(types,  nPrev+1);
            ArrayResize(lotss,      nPrev+1);   ArrayResize(OOPs,   nPrev+1);
            ArrayResize(OOTs,       nPrev+1);   ArrayResize(OSLs,   nPrev+1);
            ArrayResize(OTPs,       nPrev+1);   ArrayResize(exprs,  nPrev+1);
        }
    }
    tickets[iPos]   = OrderTicket();        types[iPos]     = Ordertype();
    Lots[iPos]      = OrderLots();          OOPs[iPos]      = OrderOpenPrice();
    OOTs[iPos]      = OrderOpenTime();      OSLs[iPos]      = OrderStopLoss();
    OTPs[iPos]      = OrderTakeProfit();    exprs[iPos]     = OrderExpiration();
}
int start(){
    int nPrev = ArraySize(tickets);
    // First handle closed orders
    for(int iDel = nPrev-1; iDel >= 0; iDel--) if (
        tickets[iDel] != 0
    &&  !OrderSelect(tickets[iDel], SELECT_BY_TICKET)
    ){
        if (OOTs[iDel] == 0)    Print("Ticket ",tickets[iDel]," deleted");
        else                    Print("Ticket ",tickets[iDel]," has closed");
        tickets[iDel] = 0;
    }
    // Then handle new and modified orders
    for(int iAct = OrdersTotal()-1; iAct >= 0 ; iAct--) if (
        OrderSelect(iAct, SELECT_BY_POS)                    // Only my orders w/
    // any Order    &&  OrderMagicNumber()  == magic.number // my magic number
    // any Order    &&  OrderSymbol()       == chart.symbol // and my pair.
    ){
        int thisTicket = OrderTicket();
        for(int iPos =nPrev-1; iPos >= 0; iPos--) if(tickets[iPos]==thisTicket){
            if( types[iPos] != Ordertype()          // OP_BUYLIMIT -> OP_BUY
            ||  Lots[iPos]  != OrderLots()
            ||  OOPs[iPos]  != OrderOpenPrice()
            ||  OOTs[iPos]  != OrderOpenTime()      // OP_BUYLIMIT -> OP_BUY
            ||  OSLs[iPos]  != OrderStopLoss()
            ||  OTPs[iPos]  != OrderTakeProfit()
            ||  exprs[iPos] != OrderExpiration(){
                Print("Ticket ",tickets[iPos]," modified");
                RememberNew(iPos);
            }
            // Else no changes
            break;              // Found it.
        }   // iPos
        if (iPos < 0){  // Never found it.
            Print("Ticket ", thisTicket," is new");
            RememberNew();
        }
    }   // iAct
}
Typed, not compiled
 
RaptorUK:
Keep track of all the order info and then you will note when anything changes . . . . it's a little hard to make a more valuable comment without knowing exactly what yo are trying to achieve.

Yes, it is only way.
Reason: