Exemplo n.º 1
1
        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()));
        }
Exemplo n.º 2
0
        public QuoteListener()
        {
            QuoteListener quoteListener       = this;
            Action <MqlErrorException> action = quoteListener.MqlError + new Action <MqlErrorException>(this.OnMqlError);

            quoteListener.MqlError = action;
        }
Exemplo n.º 3
0
 internal void OnQuote(QuoteListener quoteListener)
 {
   while (this._functionsBuffer.Count > 0)
     this._functionsBuffer.Dequeue()((MqlHandler) quoteListener);
   if (this.QuoteRecieved == null)
     return;
   this.QuoteRecieved(quoteListener);
 }
Exemplo n.º 4
0
 internal void OnQuote(QuoteListener quoteListener)
 {
     while (this._functionsBuffer.Count > 0)
     {
         Action <MqlHandler> action = this._functionsBuffer.Dequeue();
         action(quoteListener);
     }
     if (this.QuoteRecieved != null)
     {
         this.QuoteRecieved(quoteListener);
     }
 }
Exemplo n.º 5
0
 internal void OnQuote(QuoteListener quoteListener)
 {
     while (this._functionsBuffer.Count > 0)
     {
         this._functionsBuffer.Dequeue()((MqlHandler)quoteListener);
     }
     if (this.QuoteRecieved == null)
     {
         return;
     }
     this.QuoteRecieved(quoteListener);
 }
        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(); }));
        }
Exemplo n.º 7
0
        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()));
        }
Exemplo n.º 8
0
 internal void OnQuote(QuoteListener quoteListener)
 {
     while (_functionsBuffer.Count > 0)
     {
         Action<MqlHandler> action = _functionsBuffer.Dequeue();
         action(quoteListener);
     }
     if (QuoteRecieved != null)
     {
         QuoteRecieved(quoteListener);
     }
 }
Exemplo n.º 9
0
        public QuoteListener()
        {
            QuoteListener quoteListener = this;

            quoteListener.MqlError += OnMqlError;
        }
Exemplo n.º 10
0
        internal static int AccountNumber(this QuoteListener nandler)
        {
            string str = nandler.CallMqlMethod("AccountNumber", null);

            return(Convertor.ToInt(str));
        }
Exemplo n.º 11
0
        internal static string Symbol(this QuoteListener handler)
        {
            string str = handler.CallMqlMethod("Symbol", null);

            return(str);
        }
Exemplo n.º 12
0
 internal static int AccountNumber(this QuoteListener nandler)
 {
     return(Convertor.ToInt(nandler.CallMqlMethod("AccountNumber", (object[])null)));
 }
Exemplo n.º 13
0
 internal static string Symbol(this QuoteListener handler)
 {
     return(handler.CallMqlMethod("Symbol", (object[])null));
 }
Exemplo n.º 14
0
        public QuoteListener()
        {
            QuoteListener quoteListener = this;

            quoteListener.MqlError += new Action <MqlErrorException>(this.OnMqlError);
        }
Exemplo n.º 15
0
 private void metaTrader4_QuoteRecieved(QuoteListener mql)
 {
 }