private void FillData() { DateTime startDate = _StockDrawer.MinDate; while (startDate < _StockDrawer.MaxDate) { StockPoint pt = _StockDrawer.GetAt(startDate); if (pt != null) { int curIdx = chart1.Series["Price"].Points.AddXY(startDate, pt.High); chart1.Series["Price"].Points[curIdx].YValues[1] = pt.Low; chart1.Series["Price"].Points[curIdx].YValues[2] = pt.Open; chart1.Series["Price"].Points[curIdx].YValues[3] = pt.End; } startDate = startDate.AddDays(1); while (Holidays.IsWeekend(startDate)) { startDate = startDate.AddDays(1); } } chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "5", chart1.Series["Price"], chart1.Series["PriceMA5"]); chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "10", chart1.Series["Price"], chart1.Series["PriceMA10"]); chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "20", chart1.Series["Price"], chart1.Series["PriceMA20"]); }
public void Check(ICustomLog log) { DateTime startDate = MinDate; while (startDate < MaxDate) { if ((GetStock(startDate) == null) && !Holidays.IsWeekend(startDate)) { log.LogInfo("Date: " + startDate.ToLongDateString() + ", has no stock data."); } startDate = startDate.AddDays(1); } JudgeShape(log); }
private void FillData() { DateTime startDate = _StockDrawer.MinDate; double minYValue = Double.MaxValue; while (startDate < _StockDrawer.MaxDate) { StockPoint pt = _StockDrawer.GetAt(startDate); if (pt != null) { int curIdx = chart1.Series["Price"].Points.AddXY(startDate, pt.High); chart1.Series["Volume"].Points.AddXY(startDate, pt.Volume); chart1.Series["Price"].Points[curIdx].YValues[1] = pt.Low; chart1.Series["Price"].Points[curIdx].YValues[2] = pt.Open; chart1.Series["Price"].Points[curIdx].YValues[3] = pt.End; minYValue = (minYValue > pt.Low) ? pt.Low : minYValue; } startDate = startDate.AddDays(1); while (Holidays.IsWeekend(startDate)) { startDate = startDate.AddDays(1); } } if (minYValue != Double.MaxValue) { chart1.ChartAreas["Price"].AxisY.Minimum = (int)minYValue - 1; // 最小值设置 } chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "5", chart1.Series["Price"], chart1.Series["PriceMA5"]); chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "10", chart1.Series["Price"], chart1.Series["PriceMA10"]); chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "20", chart1.Series["Price"], chart1.Series["PriceMA20"]); }