You didnt select the order before
Thanks
void CancelOrder() { int orders=OrdersTotal(); for(int i=0;i<orders;i++) { ResetLastError(); ulong ticket=OrderGetTicket(i); if(ticket!=0) {//double price_open =OrderGetDouble(ORDER_PRICE_OPEN);datetime time_setup=OrderGetInteger(ORDER_TIME_SETUP);string symbol=OrderGetString(ORDER_SYMBOL); long magic_number =OrderGetInteger(ORDER_MAGIC); if(magic_number==MagicNumber) { trade.OrderDelete(ticket); } } } }
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
Hello,
I'm blocking on a code.
I wish to close an order with the number magic but it does not work, can you help me?