Hi Guys, I am working on mql4 for almost 1 year and I have learnt so much thing from your comments. however I couldn't understand OrderTicket . When I open a trade how could I know the number of Ticket. When ea opens trades, each trade will have different ticket number and then I am not able to modify this trades.
This is what I am doing:
if(OrdersTotal()==1 && OT==OP_SELL)
double STLS= OrderOpenPrice()-Ask;
Any documentation, link or comment will be appreciated. Thanks a lot.
If the order send is successful, then x= the ticket number
If x==-1 the order send was not successful
You can only use OrderTicket() or the others, after you select an order. If you have the ticket number use that with SELECT_BY_TICKET. Note: selecting by ticket works whether the order is open or closed.
Otherwise, you must perform a OrderSelect loop (SELECT_BY_POS,) filtering by magic number and symbol, to find the EA's order from others. See Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
See also Loops and Closing or Deleting Orders - MQL4 forum
You should always be able to read your code out loud and have it make sense in English. In this case if(OrderSelect(...)) reads as "if order was selected."
To add comments, please log in or register