private void metaTrader4_QuoteRecieved(QuoteListener mql) { if (OrderCount != mql.OrdersTotal()) { this.Dispatcher.BeginInvoke((Action)(() => { DataGridOpen.Items.Clear(); })); for (int i = mql.OrdersTotal() - 1; i >= 0; i--) { if (mql.OrderSelect(i, SELECT_BY.SELECT_BY_POS)) { int orderTicket = mql.OrderTicket(); string orderSymbol = mql.OrderSymbol(); double orderLots = mql.OrderLots(); double orderProfit = mql.OrderProfit(); var data = new DataGridRowAdd { OrderTicket = orderTicket, Symbol = orderSymbol, Size = orderLots, Profit = orderProfit }; this.Dispatcher.BeginInvoke((Action)(() => { DataGridOpen.Items.Add(data); })); } } } if (HistoryCount != mql.HistoryTotal()) { this.Dispatcher.BeginInvoke((Action)(() => { DataGridHistory.Items.Clear(); })); for (int i = mql.HistoryTotal() - 1; i >= 0; i--) { if (mql.OrderSelect(i, SELECT_BY.SELECT_BY_POS, POOL_MODES.MODE_HISTORY)) { int orderTicket = mql.OrderTicket(); string orderSymbol = mql.OrderSymbol(); double orderLots = mql.OrderLots(); double orderProfit = mql.OrderProfit(); var data = new DataGridRowAdd { OrderTicket = orderTicket, Symbol = orderSymbol, Size = orderLots, Profit = orderProfit }; this.Dispatcher.BeginInvoke((Action)(() => { DataGridHistory.Items.Add(data); })); } } } HistoryCount = mql.HistoryTotal(); OrderCount = mql.OrdersTotal(); double bid = mql.Bid(); double ask = mql.Ask(); this.Dispatcher.BeginInvoke((Action)(() => { BidPrice.Content = "Bid: " + bid.ToString(); })); this.Dispatcher.BeginInvoke((Action)(() => { AskPrice.Content = "Ask: " + ask.ToString(); })); }
private void metaTrader4_QuoteRecieved(QuoteListener mql) { if (OrderCount != mql.OrdersTotal()) { this.BeginInvoke((MethodInvoker)(() => dataGridView1.Rows.Clear())); for (int i = mql.OrdersTotal() - 1; i >= 0; i--) { if (mql.OrderSelect(i, SELECT_BY.SELECT_BY_POS)) { int orderTicket = mql.OrderTicket(); string orderSymbol = mql.OrderSymbol(); double orderLots = mql.OrderLots(); double orderProfit = mql.OrderProfit(); this.BeginInvoke((MethodInvoker)(() => dataGridView1.Rows.Add(orderTicket, orderSymbol, orderLots, orderProfit, "Close"))); } } } if (HistoryCount != mql.HistoryTotal()) { this.BeginInvoke((MethodInvoker)(() => dataGridView2.Rows.Clear())); for (int i = mql.HistoryTotal() - 1; i >= 0; i--) { if (mql.OrderSelect(i, SELECT_BY.SELECT_BY_POS, POOL_MODES.MODE_HISTORY)) { int orderTicket = mql.OrderTicket(); string orderSymbol = mql.OrderSymbol(); double orderLots = mql.OrderLots(); double orderProfit = mql.OrderProfit(); this.BeginInvoke((MethodInvoker)(() => dataGridView2.Rows.Add(orderTicket, orderSymbol, orderLots, orderProfit))); } } } HistoryCount = mql.HistoryTotal(); OrderCount = mql.OrdersTotal(); double bid = mql.Bid(); double ask = mql.Ask(); this.BeginInvoke((MethodInvoker)(() => BidPrice.Text = "Bid: " + bid.ToString())); this.BeginInvoke((MethodInvoker)(() => AskPrice.Text = "Ask: " + ask.ToString())); }
private void metaTrader4_QuoteRecieved(QuoteListener mql) { this.BeginInvoke((MethodInvoker)(() => dataGridView1.Rows.Clear())); for (int i = mql.OrdersTotal() - 1; i >= 0; i--) { if (mql.OrderSelect(i, SELECT_BY.SELECT_BY_POS)) { int orderTicket = mql.OrderTicket(); string orderSymbol = mql.OrderSymbol(); double orderLots = mql.OrderLots(); double orderProfit = mql.OrderProfit(); this.BeginInvoke((MethodInvoker)(() => dataGridView1.Rows.Add(orderTicket, orderSymbol, orderLots, orderProfit, "Close"))); } } double bid = mql.Bid(); double ask = mql.Ask(); this.BeginInvoke((MethodInvoker)(() => BidPrice.Text = bid.ToString())); this.BeginInvoke((MethodInvoker)(() => AskPrice.Text = ask.ToString())); }