Esempio n. 1
0
        public void Trail()
        {
            TrenderOrderManager orderManager = new TrenderOrderManager(_mqlApi, _symbol);

            // Get list of orders
            List <Order> orders = orderManager.GetOrders(_symbol);

            // Close each order
            foreach (var order in orders)
            {
                TrailOrderRequest trailOrderRequest = new TrailOrderRequest
                {
                };
                orderManager.TrailOrder(trailOrderRequest);
            }
        }
Esempio n. 2
0
        public void Close()
        {
            TrenderOrderManager orderManager = new TrenderOrderManager(_mqlApi, _symbol);

            // Get list of orders
            List <Order> orders = orderManager.GetOrders(_symbol);

            // Close each order
            foreach (var order in orders)
            {
                CloseOrderRequest closeOrderRequest = new CloseOrderRequest
                {
                    Magic    = 1000000,
                    Slippage = 3
                };
                orderManager.CloseAllOrders(closeOrderRequest);
            }
        }
Esempio n. 3
0
        public void Start()
        {
            TrenderOrderManager orderManager = new TrenderOrderManager(_mqlApi, _symbol);

            var volume = orderManager.GetAvailableVolume(_symbol);
            OpenOrderRequest openOrderRequest = new OpenOrderRequest
            {
                OrderType = _trenDirection == TrendDirectionEnum.UP ? OrderTypeEnum.BUY : OrderTypeEnum.SELL,
                Volume    = volume,

                // Todo: Get from DB!
                Slippage   = 3,
                StopLoss   = 0,
                TakeProfit = 0,
                Comment    = "Comment",
                Magic      = 1000000,

                Expiration = DateTime.MinValue
            };
            OpenOrderResponse openOrderResponse = orderManager.OpenOrder(openOrderRequest);
        }