public void Add(TOHLCV[] rcArray) { foreach (var tohlcv in rcArray) { _dc.AddRecord(tohlcv); } _dc.DrawTohlcv(); Invalidate(); }
private void DrawVolume(TOHLCV item, int x, double liv) { if (MaxVolume < 0.0001) { return; } var hvolume = (int)(item.Volume * liv); var rcvolume = new Rectangle(x, BmpHeight - hvolume, ItemWidth, hvolume); if (item.Open > item.Close && _clip.Contains(rcvolume)) { _graph.FillRectangle(Brushes.Green, rcvolume); } else if (item.Open < item.Close && _clip.Contains(rcvolume)) { _graph.FillRectangle(Brushes.Red, rcvolume); } else if (_clip.Contains(rcvolume)) { _graph.FillRectangle(Brushes.Black, rcvolume); } }
public void AddRecord(TOHLCV rec) { if (rec != null && _tohlcv.Count < MaxCapa) { _tohlcv.Add(rec); if (rec.High > HighPrice) { HighPrice = rec.High; } if (rec.Low < LowPrice || LowPrice == 0) { if (rec.Low > 0) { LowPrice = rec.Low; } } if (rec.Volume > MaxVolume) { MaxVolume = rec.Volume; } } }
public void Add(TOHLCV rc) { _dc.AddRecord(rc); _dc.DrawTohlcv(); Invalidate(); }
private int DrawPrice(TOHLCV item, int x, double lim, ref int cp) { var o = (int)((HighPrice - item.Open)*lim); var c = (int)((HighPrice - item.Close)*lim); var h = (int)((HighPrice - item.High)*lim); var l = (int)((HighPrice - item.Low)*lim); if (item.Open > item.Close) { var rc = new Rectangle(x, o, ItemWidth, c - o); if (_clip.Contains(rc) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = c; _graph.FillRectangle(Brushes.Green, rc); _graph.DrawLine(Pens.Green, x + MidOffset, h, x + MidOffset, l); } } else if (item.Open < item.Close) { var rc = new Rectangle(x, c, ItemWidth, o - c); if (_clip.Contains(rc) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = c; _graph.FillRectangle(Brushes.Red, rc); _graph.DrawLine(Pens.Red, x + MidOffset, h, x + MidOffset, l); } } else { if (lim < 0.000001 && x + ItemWidth < _pad.Width) { _graph.DrawLine(Pens.Black, 0, PriceHeight / 2, x + ItemWidth, PriceHeight / 2); } else if (item.Open > 0 && item.Close > 0 && _clip.Contains(x, o) && _clip.Contains(x+ItemWidth, o) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = o; _graph.DrawLine(Pens.Black, x, o, x + ItemWidth, o); _graph.DrawLine(Pens.Black, x + MidOffset, h, x + MidOffset, l); } } x += ItemWidth; item.RgnEnd = x; if (Regex.IsMatch(item.Time, ":30:") || Regex.IsMatch(item.Time, ":00:")) { _graph.DrawLine(Pens.LightGray, x, 0, x, PriceHeight); _graph.DrawString(item.Time, SystemFonts.SmallCaptionFont, Brushes.Black, x, 0); ++x; } return x; }
private int DrawPrice(TOHLCV item, int x, double lim, ref int cp) { var o = (int)((HighPrice - item.Open) * lim); var c = (int)((HighPrice - item.Close) * lim); var h = (int)((HighPrice - item.High) * lim); var l = (int)((HighPrice - item.Low) * lim); if (item.Open > item.Close) { var rc = new Rectangle(x, o, ItemWidth, c - o); if (_clip.Contains(rc) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = c; _graph.FillRectangle(Brushes.Green, rc); _graph.DrawLine(Pens.Green, x + MidOffset, h, x + MidOffset, l); } } else if (item.Open < item.Close) { var rc = new Rectangle(x, c, ItemWidth, o - c); if (_clip.Contains(rc) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = c; _graph.FillRectangle(Brushes.Red, rc); _graph.DrawLine(Pens.Red, x + MidOffset, h, x + MidOffset, l); } } else { if (lim < 0.000001 && x + ItemWidth < _pad.Width) { _graph.DrawLine(Pens.Black, 0, PriceHeight / 2, x + ItemWidth, PriceHeight / 2); } else if (item.Open > 0 && item.Close > 0 && _clip.Contains(x, o) && _clip.Contains(x + ItemWidth, o) && _clip.Contains(x + MidOffset, h) && _clip.Contains(x + MidOffset, l)) { cp = o; _graph.DrawLine(Pens.Black, x, o, x + ItemWidth, o); _graph.DrawLine(Pens.Black, x + MidOffset, h, x + MidOffset, l); } } x += ItemWidth; item.RgnEnd = x; if (Regex.IsMatch(item.Time, ":30:") || Regex.IsMatch(item.Time, ":00:")) { _graph.DrawLine(Pens.LightGray, x, 0, x, PriceHeight); _graph.DrawString(item.Time, SystemFonts.SmallCaptionFont, Brushes.Black, x, 0); ++x; } return(x); }