Download MetaTrader 5

Trying to close an order

To add comments, please log in or register
espina88
44
espina88  

Hello i got the next code: 

     OrderSelect(0,SELECT_BY_POS,MODE_TRADES);     
      
      int Ticket = OrderTicket();
      
 
      Comment("Beneficios ", Beneficios);
      OrderClose(Ticket,NContratos,Bid,10,clrYellow);

for trying to close an existing order, the code belongs to a function which is called just in case OrdersTotal > 0 and i have a filter which just allow 1 order at the same time.

Thats closing perfectly on strategy tester but once i test on trading demo account, having activate live trading:   Tool > Options > Expert advisor tab > Allows automated trading. Not closing :S any ideas?

whroeder1
16096
whroeder1  
  1. Check your return codes and find out why. Check your return codes (OrderSelect and OrderClose) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  2. No filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
To add comments, please log in or register