Managing Pending Ordens

 

Hi,

Is there a way to find out that a pending order has "entered into market".

I'm developing an EA and I'm checking if the pending orders are in the market using the price, but sometimes the spread variation and some fast price action, I miss the correct entry point.

Any ideas?

Best Regards

 
if (OrderType()==OP_BUY || OrderType()==OP_SELL){

        //OrderIsOpen

} 
 
zzuegg:

The problem is that I've several orders running in the same strategie.

 

I haven't done allot of this for a while now so I'm a little rusty. However, I'm currently using.

//----------Count_Active-Function:
int Count_Active(int Magic){int Ans=0;
for(i=OrdersTotal()-1;i>=0;i--){
  if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true){
    if(OrderMagicNumber()==Magic){
      if(OrderType()==OP_BUY){Ans++;}
      if(OrderType()==OP_SELL){Ans++;}
}}}
return(Ans);}

if(Count_Active(Buy_Magic)>Buy_Count){
  Buy_Count=Count_Active(Buy_Magic);}

if(Count_Active(Buy_Magic)<Buy_Count){
  Do Something;
  Buy_Count=Count_Active(Buy_Magic);
}

@ zzuegg .. 7bit talked about using Buy_Stop and Sell_Stop orders instead of Stop_Loss in his snowball system. Do you know how this is accomplished?

@ psousa .. You can keep track of the number of pending orders or active orders. When the # change then u know a pending order have become active and vice versa. Maybe someone else have a better method but this is the last way I remembered it being done.

Reason: