if(OrderType()==OP_BUY || OrderType()==OP_SELL){ //ORDER IS OPEN }//z
how do i know if pending order had allredy open ?
If OrderSend() returns a ticket number you know that it is open. If it returns -1 there was an error and you should use GetLastError() to see what it was.
You should also think about using the reliable ordersend functions from libOrderReliable.mqh or the ones from common_functions.mqh which already do some error handling and retrying and make it much more unlikely that the order is not opened due to some temporary error.
Run your EA on Alpari demo for one week in a row to see what kinds of funny errors that you have never seen before can happen, this demo server can be used as some kind of stress test, I don't know of any other demo server that is so unreliable and difficult. If your EA can survive one week on Alpari Demo without problems it can be considered as fully debugged.
zzuegg is right.
You placed an order and you know it's ticket (OrderSend() returns ticket of the order). Use OrderSelect( order_ticket, SELECT_BY_TICKET ) and check order type. That's it.
zzuegg is right.
You placed an order and you know it's ticket (OrderSend() returns ticket of the order). Use OrderSelect( order_ticket, SELECT_BY_TICKET ) and check order type. That's it.
thank you .
this is the best idea .
thank you .
this is the best idea .
Hi Gabriel,
There is no easy solution to this one. You have to make an ea that loads all the orders into an array and then compares them on the next tick. I have written one that sends email when the order status changes. It is based on the information provided in this article :-
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
how do i know if pending order had allredy open ?
the orderselect() is for opening or pending order .
do i have to catch it by comparing the open price ?