コード例 #1
0
ファイル: frm_Alerts.cs プロジェクト: koryakinp/NETproject
        public void update(String symbol, Candle lastCandle)
        {
            double prev = 0;
            double next = 0;
            double target = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
                if (row.Cells[0].Value == symbol)
                {
                    prev = Convert.ToDouble(row.Cells[1].Value);
                    next = lastCandle.Close;
                    target = Convert.ToDouble(row.Cells[2].Value);
                    row.SetValues(row.Cells[0].Value, lastCandle.Close, row.Cells[2].Value);
                }

            if ((prev <= target) && (next > target) || (prev >= target) && (next < target))
            {
                MessageBox.Show(symbol + " has reached target price " + target);
                foreach (DataGridViewRow rowToDelete in dataGridView1.Rows)
                    if (rowToDelete.Cells[0].Value.ToString() == symbol)
                    {
                        dataGridView1.Rows.Remove(rowToDelete);
                        return;
                    }
               }
        }
コード例 #2
0
        public void update(String symbol, Candle lastCandle)
        {
            foreach (DataGridViewRow row in dataGridView1.Rows)
                if (row.Cells[0].Value.ToString() == symbol)
                {
                    double prevPrice = Convert.ToDouble(dataGridView1.Rows[row.Index].Cells[2].Value);

                    double lastPrice = lastCandle.Close;
                    String formatedPrice = String.Format("{0:00.00}", lastPrice);
                    String formatedChange = getChange(lastPrice, Convert.ToDouble(row.Cells[4].Value));
                    dataGridView1.Rows[row.Index].SetValues(row.Cells[0].Value, formatedChange, formatedPrice, DateTime.Now.ToShortTimeString());
                    if ((lastCandle.Close > prevPrice) && (prevPrice != 0))
                        dataGridView1.Rows[row.Index].DefaultCellStyle.BackColor = Color.Green;
                    if (lastCandle.Close < prevPrice)
                        dataGridView1.Rows[row.Index].DefaultCellStyle.BackColor = Color.Red;
                    if (lastCandle.Close == prevPrice)
                        dataGridView1.Rows[row.Index].DefaultCellStyle.BackColor = Color.Yellow;
                    return;
                }
        }
コード例 #3
0
ファイル: frm_chart.cs プロジェクト: koryakinp/NETproject
 public void updateChart(Candle lastPrice)
 {
     dispayChart(chartControl, getChartData());
 }