Ejemplo n.º 1
0
        public void RemoveOrder(DataGridViewRow selection)
        {
            var order = new OrderData();

            order.Action      = Communication.U(ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_REMOVE);
            order.Ticket      = Communication.U(selection.Cells["OrdersColumnId"].Value);
            order.OrderStatus = 1;

            Delegation.SetTradeDelegates(order, string.Empty);
        }
Ejemplo n.º 2
0
        public void ChangePosition(DataGridViewRow selection)
        {
            var order = new OrderData();

            order.TypeTime    = Communication.U(ENUM_ORDER_TYPE_TIME.ORDER_TIME_GTC);
            order.Action      = Communication.U(ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_SLTP);
            order.SL          = Communication.D(selection.Cells["PositionsColumnSL"].Value);
            order.TP          = Communication.D(selection.Cells["PositionsColumnTP"].Value);
            order.Currency    = Communication.S(selection.Cells["PositionsColumnSymbol"].Value).PadRight(Constants.SMALL_CHAR).ToCharArray();
            order.OrderStatus = 1;

            Delegation.SetTradeDelegates(order, string.Empty);
        }
Ejemplo n.º 3
0
        private void GridCellClick(object sender, DataGridViewCellEventArgs e)
        {
            Protect();

            var indexRow    = e.RowIndex;
            var indexColumn = e.ColumnIndex;
            var grid        = sender as DataGridView;

            if (indexRow > -1 && indexColumn > -1 && grid[indexColumn, indexRow].ReadOnly == false)
            {
                var activeCell = grid[indexColumn, indexRow];

                if (activeCell.GetType() == typeof(DataGridViewButtonCell))
                {
                    var name = activeCell.OwningColumn.Name;

                    HideEditors(grid, activeCell.RowIndex, false);

                    if (name.Equals("PositionsColumnActionsBreakeven"))
                    {
                        var order     = new OrderData();
                        var selection = activeCell.OwningRow;

                        order.TypeTime    = Communication.U(ENUM_ORDER_TYPE_TIME.ORDER_TIME_GTC);
                        order.Action      = Communication.U(ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_SLTP);
                        order.SL          = Communication.D(selection.Cells["PositionsColumnOpening"].Value);
                        order.TP          = Communication.D(selection.Cells["PositionsColumnTP"].Value);
                        order.Currency    = Communication.S(selection.Cells["PositionsColumnSymbol"].Value).PadRight(Constants.SMALL_CHAR).ToCharArray();
                        order.OrderStatus = 1;

                        Delegation.SetTradeDelegates(order, string.Empty);
                    }

                    if (name.Equals("PositionsColumnActionsRemove"))
                    {
                        RemovePosition(activeCell.OwningRow);
                    }

                    if (name.Equals("OrdersColumnActionsRemove"))
                    {
                        RemoveOrder(activeCell.OwningRow);
                    }
                }
                else
                {
                    DisplayEditors(grid, activeCell.OwningRow);
                    ActivateEditors(grid, e.ColumnIndex, e.RowIndex);
                }
            }
        }
Ejemplo n.º 4
0
        public void LimitButtonSendClick(object sender, EventArgs e)
        {
            Protect();

            OrderData order = LimitOrderPrepare();

            if (LimitOrderValidation(order))
            {
                Delegation.SetTradeDelegates(order, LimitTextComments.Text);
                LimitTextSL.Text       = string.Empty;
                LimitTextTP.Text       = string.Empty;
                LimitTextComments.Text = string.Empty;
            }
        }
Ejemplo n.º 5
0
        public void MarketButtonSellClick(object sender, EventArgs e)
        {
            Protect();

            OrderData order = MarketOrderPrepare(ENUM_ORDER_TYPE.ORDER_TYPE_SELL);

            if (MarketOrderValidation(order))
            {
                Delegation.SetTradeDelegates(order, MarketTextComments.Text);
                MarketTextSL.Text       = string.Empty;
                MarketTextTP.Text       = string.Empty;
                MarketTextComments.Text = string.Empty;
            }
        }
Ejemplo n.º 6
0
        public void ChangeOrder(DataGridViewRow selection)
        {
            var order = new OrderData();

            order.TypeTime    = Communication.U(ENUM_ORDER_TYPE_TIME.ORDER_TIME_GTC);
            order.Action      = Communication.U(ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_MODIFY);
            order.Price       = Communication.D(selection.Cells["OrdersColumnOpening"].Value);
            order.Ticket      = Communication.U(selection.Cells["OrdersColumnId"].Value);
            order.SL          = Communication.D(selection.Cells["OrdersColumnSL"].Value);
            order.TP          = Communication.D(selection.Cells["OrdersColumnTP"].Value);
            order.OrderStatus = 1;

            Delegation.SetTradeDelegates(order, string.Empty);
        }
Ejemplo n.º 7
0
        public void RemovePosition(DataGridViewRow selection)
        {
            var order     = new OrderData();
            var orderType = Communication.S(selection.Cells["PositionsColumnOperation"].Value).ToUpper().Contains("BUY") ?
                            Communication.U(ENUM_ORDER_TYPE.ORDER_TYPE_SELL) :
                            Communication.U(ENUM_ORDER_TYPE.ORDER_TYPE_BUY);

            order.TypeTime    = Communication.U(ENUM_ORDER_TYPE_TIME.ORDER_TIME_GTC);
            order.TypeFilling = Communication.U(ENUM_ORDER_TYPE_FILLING.ORDER_FILLING_FOK);
            order.Action      = Communication.U(ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_DEAL);
            order.Volume      = Communication.D(selection.Cells["PositionsColumnLots"].Value);
            order.Currency    = Communication.S(selection.Cells["PositionsColumnSymbol"].Value).PadRight(Constants.SMALL_CHAR).ToCharArray();
            order.Type        = orderType;
            order.OrderStatus = 1;
            order.Deviation   = 0;

            Delegation.SetTradeDelegates(order, string.Empty);
        }