Hopefully simple/quick question about OrderClose()
Drew Clayman:
Hi, I'm trying have an open order close, but i get an error saying "invalid lots number for OrderClose function." The same happens for the ticket, "invalid ticket number", unless i save the order as a variable. I imagine there's something obvious that I'm missing and would really appreciate any help.
void OnStart() { int ticket = OrderSend(NULL,OP_SELL,0.1,Bid,200,Ask+Point*50,Bid-Point*50,NULL,0,0,clrNONE); Sleep(2000); if(!OrderSelect(ticket,SELECT_BY_TICKET)) Print("Error of order selection ", _LastError); double lots = OrderLots(); if (!OrderClose(ticket,lots,Ask,200)) Print("Error of closing - ", _LastError); }
double lots = OrderLots(); double price = OrderClosePrice();You can not use any Trade Functions until you select an order.
Hi, I'm trying have an open order close, but i get an error saying "invalid lots number for OrderClose function." The same happens for the ticket, "invalid ticket number", unless i save the order as a variable. I imagine there's something obvious that I'm missing and would really appreciate any help.