how do i choose the last order price of current symbol?
if (LastHistOrderSelect(OP_BUY, OP_SELL)) Print(OrderOpenPrice());
bool LastHistOrderSelect(int type1, int type2) { datetime tm = -1; int ticket = -1; int cnt = OrdersHistoryTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue; if (OrderSymbol() != Symbol()) continue; int type = OrderType(); if (type == type1 || type == type2) { if (OrderCloseTime() > tm) { tm = OrderCloseTime(); ticket = OrderTicket(); } } } return (OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY)); }

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