if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==true) { Print("function " + ticket); }
MODE_TRADES is ignored if you select by ticket.
If you only want to work with the trade when it is open
if(OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()==0)
Thank you for your helpful explanation, GumRai! :)
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
could anyone be so kind to help me understand the OrderSelect() function?
When I load this sample EA an order opens and the two Print function start and keep printing. When I then close the trade by hand I thought OrderSelect() by ticket in MODE_TRADES ("order selected from trading pool(opened and pending orders)") should turn false, but it does not. I thought when I close the order it is shifted into history and can then only be accessed by MODE_HISTORY, but it seems not.
I wonder how to tell an EA to stop doing something in the OnTick, if not by OrderSelect.
Thanks you!