//--------------------------------------------------------------------- // Gets the number of specified type of orders (market or pending). //--------------------------------------------------------------------- #property copyright "© RickD 2006-2007" #property link "www.e2e-fx.net" int OrdersCount(int type) { int orders = 0; int cnt = OrdersTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; //if (OrderSymbol() != Symbol()) continue; //if (OrderMagicNumber() != Magic) continue; if (OrderType() == type) orders++; } return (orders); }