Review the example for the OrderSend(). It may help with ideas to delete pending orders.
Documentation on MQL5: Trade Functions / OrderSend
- www.mql5.com
Trade Functions / OrderSend - Documentation on MQL5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone,
I made a Expert that uses Pending Orders in MQL4, but I cannot delete pending orders in MQL5 Strategy Tester. Anyone had more success than me?
Here is the part in the source code:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
for(int cnt=OrdersTotal();cnt>0;cnt--)
{
ulong ticket = OrderGetTicket(cnt);
if(ticket==0) continue;
if(OrderGetString(ORDER_SYMBOL)==m_Pair && OrderGetString(ORDER_COMMENT)=="New" && OrderGetInteger(ORDER_TYPE)>=ORDER_TYPE_BUY_LIMIT)
{
m_Trade.OrderDelete(ticket);
Print("Deleted Order #",ticket,": ",m_Trade.CheckResultRetcodeDescription());
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
The m_Trade.CheckResultRetcodeDescription() always returns "TRADE_RETCODE_INVALID"
Best Regards,
Tiago A. Simões