By trying to delete pending orders from ticket number I got the error message "OrderDelete error 4108"
Here is my code:
bool DeletePendingOrder(int ticket)
double freezelevel = (MarketInfo(Symbol(),MODE_FREEZELEVEL)+1)*Point;
double openPrice, currentPrice;
if(OrderMagicNumber()!=MagicNumber) return false;
if((orderType==OP_BUYSTOP && currentPrice>=openPrice-freezelevel) ||
(orderType==OP_SELLSTOP && currentPrice<=openPrice+freezelevel))
from mql help
error 4108 = invalid ticket
If you look at the code of my function before to call OrderDelete() I am checking that the ticket is existing and it is related to a pending order. So I do not understand why I get this error message.
OrderSelect function select order in open orders list but also in history orders list.
if( OrderCloseTime() > 0 )
after OrderSelect call
Thank you Eugenio and Alain. I thought the Order type value changed when the order is already deleted.
HistoryOrderSelect() does not exist in MQL4
This is the MQL4 and MT4 sub forum.