Order Total by Currency
yarns90401:
Does anyone have the code to get the order count total by currency? Something like OrdersTotal(Symbol())? This would get the count for open positions for the symbol, not pending orders.
Thanks in advance,
Y
Does anyone have the code to get the order count total by currency? Something like OrdersTotal(Symbol())? This would get the count for open positions for the symbol, not pending orders.
Thanks in advance,
Y
int ScanOpenTrades()
{
int total = OrdersTotal();
int numords = 0;
for(int cnt=0; cnt<=total-1; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS);
if(OrderType()<=OP_BUY)
{
if(Magic > 0) if(OrderMagicNumber() == Magic && ordersymbol()==symbol()) numords++;
if(Magic == 0 && ordersymbol()==symbol()) numords++;
}
}
return(numords);
}
This code has worked well for me.
Wackena
int OpenOrders(){ int orders=0; for (int i=0; i<OrdersTotal(); i++){ if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if(OrderSymbol()==Symbol()) orders++; } return(orders); }
Print(Symbol()," Open Orders = ",OpenOrders());
Thanks in advance,
Y