I have two pending orders open, with magic number 222 and 444. I want the ea to delete the order with the largest magic number i.e 444. How do I amend this code to perform this function?
Thanks.
//+------------------------------------------------------------------+//| Delete all pending orders |//+------------------------------------------------------------------+void DeleteAllPendingOrders(void)
{
for(int i=OrdersTotal()-1; i>=0; i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its propertiesif(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic)
if(!m_trade.OrderDelete(m_order.Ticket()))
if(InpPrintLog)
Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.OrderDelete ",m_order.Ticket())
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have two pending orders open, with magic number 222 and 444. I want the ea to delete the order with the largest magic number i.e 444. How do I amend this code to perform this function?
Thanks.