Пример #1
0
        public IEnumerable <Order> GetLimitOrders(OrderSide side)
        {
            List <Order> listOrders = new List <Order>();

            int total = MetaAPI.OrdersTotal();

            for (int i = total - 1; i >= 0; i--)
            {
                MetaAPI.OrderSelect(i, SelectType.SELECT_BY_POS, SelectModeType.MODE_TRADES);
                if (side == OrderSide.Buy)
                {
                    if (MetaTypeConvertor.ToOrderType(MetaAPI.GetOrderType()) == OrderType.Limit && MetaTypeConvertor.ToOrderSide(MetaAPI.GetOrderType()) == OrderSide.Buy && MagicNumber == MetaAPI.GetOrderMagicNumber())
                    {
                        listOrders.Add(BuildOrderFromCurrent());
                    }
                }
                else
                {
                    if (MetaTypeConvertor.ToOrderType(MetaAPI.GetOrderType()) == OrderType.Limit && MetaTypeConvertor.ToOrderSide(MetaAPI.GetOrderType()) == OrderSide.Sell && MagicNumber == MetaAPI.GetOrderMagicNumber())
                    {
                        listOrders.Add(BuildOrderFromCurrent());
                    }
                }
            }
            return(listOrders);
        }
Пример #2
0
 internal Order(int orderID, string symbol, MetaOperationType mot, int openprice, int volume, int SL, int TP, string comment)
     : this(orderID, symbol, MetaTypeConvertor.ToOrderType(mot), openprice, MetaTypeConvertor.ToOrderSide(mot), volume, SL, TP, comment)
 {
 }