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.

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, 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.