Beispiel #1
0
        private void Createbutton_Click(object sender, EventArgs e)
        {
            try {
                if (!MyUtility.isValidName(DataSetName.Text))
                {
                    throw new Exception();
                }


                if (this.listView1.SelectedItems.Count == 0)
                {
                    MessageBox.Show("Please select a stock from Historical data table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                string insetrquery = "insert into analyse_lists values('" + this.listView1.SelectedItems[0].SubItems[0].Text.ToString() + "','" + DataSetName.Text.ToString() + "','" + dateStart.Value.ToShortDateString() + "','" + dateEnd.Value.ToShortDateString() + "')";
                //ss.insert(insetrquery);
                if (ss.insert(insetrquery))
                {
                    ListViewItem lvl = new ListViewItem(DataSetName.Text.ToString());
                    lvl.SubItems.Add(this.listView1.SelectedItems[0].SubItems[0].Text.ToString());
                    lvl.SubItems.Add(dateStart.Value.ToShortDateString());
                    lvl.SubItems.Add(dateEnd.Value.ToShortDateString());
                    listView2.Items.Add(lvl);
                }

                //Loading Load = new Loading();
                //Load.label1.Text = "Calculating MACD ... ";
                //Load.Show();

                TimeSeries myview = new CreateView(this.dateStart.Value.Date, this.dateEnd.Value.Date, HistoTextBox.Text, DataSetName.Text);
                TimeSeries MAC    = new MACDTEMP(this.dateStart.Value.Date, this.dateEnd.Value.Date, HistoTextBox.Text, DataSetName.Text);
                //Load.label1.Text = "Calculating Stocastic Occilator ... ";
                TimeSeries STO = new STOCTEMP(this.dateStart.Value.Date, this.dateEnd.Value.Date, HistoTextBox.Text, DataSetName.Text);
                // Load.label1.Text = "Calculating RSI ... ";
                TimeSeries RSI = new RSITEMP(this.dateStart.Value.Date, this.dateEnd.Value.Date, HistoTextBox.Text, DataSetName.Text);
                //Load.label1.Text = "Calculating GMMA ... ";
                TimeSeries GMMA  = new GMMATEMP(this.dateStart.Value.Date, this.dateEnd.Value.Date, HistoTextBox.Text, DataSetName.Text);
                string     query =

                    //view = "+DataSetName+"_View
                    //MACDTEMP =  "+DataSetName+"_MACD
                    //Sto = "+DataSetName+"_STO
                    //RSI = "+DataSetName+"_RSI
                    //GMMA = "+DataSetName+"_GMMA

                    //  YLTView = "+DataSetName+"_AllView

                    "create view " + DataSetName.Text + "_AllView as " +
                    "select " + DataSetName.Text + "_View.Date_, " + DataSetName.Text + "_View.Open_, " + DataSetName.Text + "_View.High, " + DataSetName.Text + "_View.Low, " + DataSetName.Text + "_View.Close_, " + DataSetName.Text + "_View.Volume, " + DataSetName.Text + "_View.Adj_Close," +
                    "" + DataSetName.Text + "_MACD._12_Days_Ema ," + DataSetName.Text + "_MACD._26_Days_Ema , " + DataSetName.Text + "_MACD.MACD_12Minus26_days, " + DataSetName.Text + "_MACD._Signal, " + DataSetName.Text + "_MACD._histogram, " +
                    "" + DataSetName.Text + "_RSI.Change," + DataSetName.Text + "_RSI.gain," + DataSetName.Text + "_RSI.Loss, " + DataSetName.Text + "_RSI.Avg_Gain, " + DataSetName.Text + "_RSI.Avg_Loss," + DataSetName.Text + "_RSI.RS," + DataSetName.Text + "_RSI._14_days_RSI, " +
                    "" + DataSetName.Text + "_STO.highest_high_14, " + DataSetName.Text + "_STO.Lowest_low_14, " + DataSetName.Text + "_STO._14_day_StochasticOscillator, " +
                    "" + DataSetName.Text + "_GMMA._3_days_Ema," + DataSetName.Text + "_GMMA._5_days_Ema," + DataSetName.Text + "_GMMA._8_days_Ema," + DataSetName.Text + "_GMMA._10_days_Ema," + DataSetName.Text + "_GMMA._15_days_Ema," + DataSetName.Text + "_GMMA._30_days_Ema," + DataSetName.Text + "_GMMA._35_days_Ema, " +
                    "" + DataSetName.Text + "_GMMA._40_days_Ema," + DataSetName.Text + "_GMMA._45_days_Ema," + DataSetName.Text + "_GMMA._50_days_Ema," + DataSetName.Text + "_GMMA._60_days_Ema " +
                    " from " + DataSetName.Text + "_View, " + DataSetName.Text + "_MACD , " + DataSetName.Text + "_RSI , " + DataSetName.Text + "_GMMA, " + DataSetName.Text + "_STO where " + DataSetName.Text + "_View.ID= " + DataSetName.Text + "_MACD.ID and " + DataSetName.Text + "_View.ID = " + DataSetName.Text + "_RSI.ID and " + DataSetName.Text + "_View.ID =" + DataSetName.Text + "_GMMA.ID and " + DataSetName.Text + "_View.ID = " + DataSetName.Text + "_STO.ID";
                ss.createView(query);
                //MAC.createTable();
                //MAC.dropMACD();
                //Load.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid Table name");
            }
        }