示例#1
0
        /// <summary>
        ///
        /// </summary>
        private void PanelSettings_InitObjectsControls()
        {
            //Получаем коды клиента
            comboBoxCodeClient.SetListValues(Trader.Objects.tClients.ToArray().Select(c => c.Code).ToArray(),
                                             ClientCode.Value);
            comboBoxCodeClient.SelectedValueChanged += (ss, ee) =>
            {
                if (comboBoxCodeClient.SelectedItem.NotIsNull())
                {
                    ClientCode.Value = comboBoxCodeClient.SelectedItem.ToString();
                }
            };
            comboBoxTypeClientLimit.SelectedValueChanged += (ss, ee) =>
            {
                TypeClientLimit.Value = comboBoxTypeClientLimit.SelectedItem.ToString().ToInt32();
            };
            checkBoxAutoSizePrice.Click += (s, e) =>
            {
                AutoSizeGraphic.Value = checkBoxAutoSizePrice.Checked;
            };
            ToolStripMenuItemAutoSize.Click += (s, e) =>
            {
                AutoSizeGraphic.Value = !ToolStripMenuItemAutoSize.Checked;
            };

            comboBoxTimeFrame.InitDefault();
            comboBoxTimeFrame.DataSource            = SelectorTimeFrame.GetAll();
            comboBoxTimeFrame.SelectedIndex         = SelectorTimeFrame.GetIndex(TimeFrameUse.Value);
            comboBoxTimeFrame.SelectedIndexChanged += (s, e) =>
            {
                ComboBox sen = (ComboBox)s;
                if (sen.SelectedItem.NotIsNull() && sen.SelectedItem is SelectorTimeFrame)
                {
                    var item = (SelectorTimeFrame)sen.SelectedItem;
                    TimeFrameUse.Value = item.TimeFrame;
                }
            };

            //Кол-во видимых свечей
            CountCandleInGraphic = SettingsDepth.GetTF(TimeFrameUse.Value, "CountVisibleCandle");
        }
示例#2
0
        public void Init()
        {
            this.comboBoxTFBuy.SelectedIndexChanged += (s, e) =>
            {
                var sender = (ComboBox)s;
                this.TimeFrameBuy = ((SelectorTimeFrame)sender.SelectedItem).TimeFrame;
            };
            this.comboBoxTFBuy.SelectedIndexChanged += (s, e) =>
            {
                var sender = (ComboBox)s;
                this.TimeFrameSell = ((SelectorTimeFrame)sender.SelectedItem).TimeFrame;
            };

            var tf = SelectorTimeFrame.GetAll();

            this.comboBoxTFBuy.DataSource     = tf.ToArray();
            this.comboBoxTFSell.DataSource    = tf.ToArray();
            this.comboBoxTFBuy.SelectedIndex  = 4;
            this.comboBoxTFSell.SelectedIndex = 4;


            this.InitBorderPrices();

            button1.Click += (s, e) =>
            {
                this.EmulateSignal();
            };

            EventHandler eventLastPrice1s = (s, e) =>
            {
                this.CancelOldOrders();
            };
            DispatcherTimer MainTimer = new DispatcherTimer();

            MainTimer.Tick    += new EventHandler(eventLastPrice1s);
            MainTimer.Interval = new TimeSpan(0, 0, IntervalTimer);
            MainTimer.Start();

            this.labelMinStepPrice.Text = this.TrElement.Security.Params.MinPriceStep.ToString();
            this.labelPriceTick.Text    = this.TrElement.Security.Params.StepPrice.ToString();
        }
示例#3
0
        private void InitPanelFastGap()
        {
            numericUpDownFGSizeGap.InitWheelDecimal(0, 10000, 1);
            FastGapSettings.Option_1             = (int)numericUpDownFGSizeGap.Value;
            numericUpDownFGSizeGap.ValueChanged += (s, e) =>
            {
                FastGapSettings.Option_1 = (int)numericUpDownFGSizeGap.Value;
            };

            numericUpDownFGTimeStep.InitWheelDecimal(0, 10000000, 1);
            numericUpDownFGTimeStep.Value         = FastGapSettings.StepTime;
            numericUpDownFGTimeStep.ValueChanged += (s, e) =>
            {
                FastGapSettings.StepTime = (int)numericUpDownFGTimeStep.Value;
            };

            comboBoxFGTimeFrame.DataSource            = SelectorTimeFrame.GetAll();
            comboBoxFGTimeFrame.SelectedIndex         = SelectorTimeFrame.GetIndex(FastGapSettings.TimeFrame);
            comboBoxFGTimeFrame.SelectedIndexChanged += (s, e) => {
                var tf = ((SelectorTimeFrame)comboBoxFGTimeFrame.SelectedItem).TimeFrame;
                FastGapSettings.TimeFrame = tf;
            };
        }
示例#4
0
        /// <summary>
        /// Метод первоначальных настроек
        /// </summary>
        private void FirstStart()
        {
            var tf = SelectorTimeFrame.GetAll();

            foreach (var panel in this.ListGraph)
            {
                if (panel.ComboBoxTimeFrame.NotIsNull())
                {
                    panel.ComboBoxTimeFrame.DataSource    = tf.ToArray();
                    panel.ComboBoxTimeFrame.SelectedIndex = panel.SelectIndexTimeFrame;
                }
                panel.Canvas.Paint += (s, e) =>
                {
                    if (panel.Graphic.NotIsNull())
                    {
                        var g = e.Graphics;
                        panel.Graphic.AllToCanvas(g);
                    }
                };
                panel.Graphic.SetObjectPaint(panel.Canvas);
                //Клик по графику для указания цены
                panel.Canvas.Click += (s, e) =>
                {
                    if (panel.TrElement.IsNull())
                    {
                        return;
                    }
                    panel.Price.Value = panel.TrElement.Security.LastTrade.NotIsNull() ?
                                        panel.TrElement.Security.LastTrade.Price : 0;
                };
                //увеличить график
                panel.ButtonLess.Click += (s, e) =>
                {
                    panel.CountCandleVisible += 3;
                    if (panel.CountCandleVisible > 1000)
                    {
                        panel.CountCandleVisible = 1000;
                    }
                    this.UpdateGraphic(panel);
                };
                //уменьшить график
                panel.ButtonMore.Click += (s, e) =>
                {
                    panel.CountCandleVisible -= 3;
                    if (panel.CountCandleVisible < 5)
                    {
                        panel.CountCandleVisible = 5;
                    }
                    this.UpdateGraphic(panel);
                };
                panel.ButBuy.Click += (s, e) =>
                {
                    this.CreateOrder(panel, true);
                };
                panel.ButSell.Click += (s, e) =>
                {
                    this.CreateOrder(panel, false);
                };
                panel.ButCloseOrder.Click += (s, e) =>
                {
                    if (panel.TrElement.IsNull())
                    {
                        return;
                    }
                    this.Trader.CancelAllOrder(panel.TrElement.Security);
                };

                panel.OpenDepth.Click += (s, e) =>
                {
                    if (this.Trader.IsNull())
                    {
                        return;
                    }
                    if (panel.TrElement.IsNull())
                    {
                        return;
                    }
                    this.Parent.ShowGraphicDepth(panel.TrElement.Security);
                };
            }
            int ind = 1;

            foreach (var sec in LoadListTradeSec())
            {
                SetSecurityInPanel(this.ListGraph.FirstOrDefault(p => p.Index == ind), sec);
                ind++;
            }

            //SetSecurityInPanel(this.ListGraph.FirstOrDefault(p => p.Index == 1), "SiZ7", "SPBFUT");
            //SetSecurityInPanel(this.ListGraph.FirstOrDefault(p => p.Index == 2), "RIZ7", "SPBFUT");
            //SetSecurityInPanel(this.ListGraph.FirstOrDefault(p => p.Index == 3), "BRF8", "SPBFUT");
        }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        public void InitPanelSignal()
        {
            SignalView.GSMSignaler.Phone = Connector.QuikConnector.ConfSettings.GetParam("Main", "PhoneSignal").Value;

            comboBoxSecSign.SetListValues(Global.GetWorkingListSec().ToArray());
            comboBoxSecSign.TextChanged += (s, e) =>
            {
                var text = comboBoxSecSign.Text;
                if (text.Length >= 2)
                {
                    var listSec = Trader.Objects.tSecurities.SearchAll(el => el.Code.ToLower().Contains(text.ToLower()) ||
                                                                       el.Name.ToLower().Contains(text.ToLower())).Select(el => el.ToString());
                    if (listSec.Count() > 0)
                    {
                        comboBoxSecSign.Clear();
                        comboBoxSecSign.SetListValues(listSec);
                    }
                }
                comboBoxSecSign.Select(text.Length, 0);
                UpdateGridSignals();
            };
            comboBoxSecSign.KeyPress += (s, e) =>
            {
                var k = e.KeyChar;
                if (e.KeyChar == 13)
                {
                    if (comboBoxSecSign.Items.Count > 0)
                    {
                        comboBoxSecSign.Text = comboBoxSecSign.Items[0].ToString();
                    }
                }
            };

            tableLayoutPanel14.Enabled = false;
            tableLayoutPanel8.Enabled  = false;
            splitContainer2.Enabled    = false;

            SetCurrentPorts();

            numericUpDownPrice.InitWheelDecimal();
            numericUpDownPrice.Maximum = 1000000000;

            numericUpDownSignVolume.InitWheelDecimal();
            numericUpDownSignVolume.Maximum   = 1000000000;
            numericUpDownSignVolume.Minimum   = 0;
            numericUpDownSignVolume.Increment = 1;

            var tf = SelectorTimeFrame.GetAll();

            comboBoxSignTimeFrame.DataSource    = tf.ToArray();
            comboBoxSignTimeFrame.SelectedIndex = 3;

            buttonSignAddVol1000.Click += (s, e) =>
            {
                numericUpDownSignVolume.Value += 1000;
            };
            buttonAddSignVolume.Click += buttonAddSignVolume_Click;

            comboBoxSecSign.SelectedValueChanged += (s, e) =>
            {
                if (comboBoxSecSign.SelectedItem is string)
                {
                    LastSecSignal = GetSecCodeAndClass(comboBoxSecSign.SelectedItem.ToString());
                    if (LastSecSignal.NotIsNull())
                    {
                        numericUpDownPrice.InitSecurity(LastSecSignal);
                        numericUpDownPrice.Value = LastSecSignal.LastPrice.NotIsNull() ? LastSecSignal.LastPrice : 0;
                        labelSignNameSec.Text    = LastSecSignal.Name;
                    }
                }

                UpdateGridSignals();
            };

            comboBoxCond.InitDefault();
            comboBoxCond.SetListValues(new string[] { ">=", ">", "<=", "<", "==" });
            comboBoxCond.SelectedIndex = 0;

            SignalView.GSMSignaler.OnAdd += (s) =>
            {
                UpdateGridSignals();
            };
            SignalView.GSMSignaler.OnRemove += (s) =>
            {
                UpdateGridSignals();
            };

            /*GSMSignaler.OnLoad += () =>
             *          {
             *                  UpdateGridSignals();
             *          };*/
            SignalView.GSMSignaler.Load();

            buttonSignUp.Click   += (s, e) => { MoveSignal(true); };
            buttonSignDown.Click += (s, e) => { MoveSignal(false); };

            dataGridViewListSign.Click += (s, e) =>
            {
                if (s is DataGridView)
                {
                    var dataGrid = (DataGridView)s;
                    foreach (DataGridViewRow r in dataGrid.Rows)
                    {
                        if (r.Selected)
                        {
                            LastIndexSelectRow = r.Index;
                        }
                    }
                }
            };
            UpdateGridSignals();

            AutoFindPort();
        }