How can my EA notify me when a Pending Order is filled?

 

Hello,

I have a simple EA that opens my pending orders with Entry Price, Stop Loss and Take Profit parameters that I manually enter.  I want the EA to alert me when a pending order is filled.  I tried using

    if(OrderOpenTime() !=0)

but pending orders are considered "open" when they are accepted by the trade server, so I was notified as soon as the EA set the order.

Any ideas?

Thanks in advance for the help.

Scratchman

 
scratchman:

Hello,

I have a simple EA that opens my pending orders with Entry Price, Stop Loss and Take Profit parameters that I manually enter.  I want the EA to alert me when a pending order is filled.  I tried using

    if(OrderOpenTime() !=0)

but pending orders are considered "open" when they are accepted by the trade server, so I was notified as soon as the EA set the order.

Any ideas?

Keep checking the OrderType(),  when it becomes OP_BUY or OP_SELL then it is no longer pending . . .
 

Give it a magic number. If the ea detects an increase in open trades with the magic number it alerts.

@raptor your system will alert forever until the trade closes.

 
tonny:

Give it a magic number. If the ea detects an increase in open trades with the magic number it alerts.

@raptor your system will alert forever until the trade closes.

My system will not Alert forever . . .   I wouldn't let it.
 

Thanks for the input, I will try each way to see which works best for me.

 
tonny: @raptor your system will alert forever until the trade closes.
No it wouldn't. He said to alert when it changes. Once it changes to a OP_BUY it doesn't change again. There for you test for a change, not for a value.
Reason: