Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            KL_1MK               = new Kline(plotSurface2D1, plotSurface2D2, 1, 300);
            KL_1DK               = new Kline(plotSurface2D3, plotSurface2D4, 1, 40);
            KL_1DK.KP            = new candlep(KL_1DK);
            radioButton1.Checked = true;

            dateTimePicker1.Value = RandomDate.RandomSelectDate();
            load_dayK();

            InitChart();
            //dataGridView1.DataSource = simu.MatList;
        }
Example #2
0
        public void quote()
        {
            if (!RandomDate.CheckDate(dateTimePicker1.Value))
            {
                comboBox1.InvokeIfRequired(() => {
                    comboBox1.Enabled = true;
                });

                button1.InvokeIfRequired(() =>
                {
                    button1.Enabled = true;
                });

                dataGridView1.InvokeIfRequired(() =>
                {
                    dateTimePicker1.Enabled = true;
                });
                MessageBox.Show("No Data");
                NPlot.PointPlot p = new PointPlot();
                p.Marker.Type = Marker.MarkerType.Circle;
                return;
            }
            using (StreamReader sr = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\TXF\\" + dateTimePicker1.Value.ToString("MM-dd-yyyy") + "TXF.TXT"))
            {
                string[] wordss = sr.ReadToEnd().Split('\n');
                bool     istart = false;

                string date = "";
                dateTimePicker1.InvokeIfRequired(() => {
                    date = dateTimePicker1.Value.ToString("yyyy/M/d");
                });

                foreach (string words in wordss)
                {
                    if (words == "")
                    {
                        break;
                    }
                    string[] word = words.Split(',');

                    //search start
                    if (word[1].Length < 6)
                    {
                        return;
                    }
                    if (word[1].Substring(0, 6) == "084500")
                    {
                        istart = true;
                    }
                    if (int.Parse(word[1].Substring(0, 4)) > 1344)
                    {
                        break;
                    }
                    if (!istart)
                    {
                        continue;
                    }

                    //MK
                    MKdata.Add(word[1], word[4], word[5], word[6]);
                    DKdata.Add(date, word[4], word[5], word[6]);
                    mACD.macd(MKdata.kdata);

                    //run
                    int ss = times.tDiff(word[1]);
                    if (ss > 0)
                    {
                        Thread.Sleep(ss);
                    }
                }
            }


            comboBox1.InvokeIfRequired(() => {
                comboBox1.Enabled = true;
            });

            button1.InvokeIfRequired(() =>
            {
                button1.Enabled = true;
            });

            dataGridView1.InvokeIfRequired(() =>
            {
                dateTimePicker1.Enabled = true;
            });

            T_Quote.Abort();
        }