// Новые серии для отрисовки public void ReloadSeries(DataSeries ds, DrawSeries drs, double open) { Sec = ds; DrawSer = drs; PriceOpen = open; }
public void AddRealTick(DataSeries ds, Tick tk) { Load = false; //int i = 0; if (Bars.Count != ds.Bars.Count) { // var bar = ds.Bars.Last(); { Bars.Add(tk.dateTimeTick, new BarDraw()); xOf = wiCl * (Bars.Count - 1); yTo = Convert.ToInt32((tk.priceTick - startPrice) / deltaTick) * hiCl; if (tk.volumeTick > maxVol) { xTo = xOf + wiCl - 1; } else if (tk.volumeTick > minVol) { xTo = xOf + ((tk.volumeTick * 100 / minVol) * (wiCl / 2 - 1)) / 100; } else { xTo = xOf + ((tk.volumeTick * 100 / minVol) * (wiCl / 3 - 1)) / 100; } if (xTo == xOf) { xTo++; } Bars.Last().Value.Price.Add(tk.priceTick, new int[4] { xOf, xTo, yTo, tk.volumeTick }); } } else { var bar = Bars.Last(); if (bar.Value.Price.ContainsKey(tk.priceTick)) { xOf = bar.Value.Price[tk.priceTick][0]; int vol = Convert.ToInt32(ds.Bars.Last().Value.Price[tk.priceTick].Volume); if (vol > maxVol) { xTo = xOf + wiCl - 1; } else if (vol > minVol) { xTo = xOf + ((vol * 100 / minVol) * (wiCl / 2 - 1)) / 100; } else { xTo = xOf + ((vol * 100 / minVol) * (wiCl / 3 - 1)) / 100; } if (xTo == xOf) { xTo++; } bar.Value.Price[tk.priceTick][1] = xTo; bar.Value.Price[tk.priceTick][3] = vol; yTo = bar.Value.Price[tk.priceTick][2]; } else { xOf = wiCl * (ds.Bars.Count - 1); yTo = Convert.ToInt32((tk.priceTick - startPrice) / deltaTick) * hiCl; if (tk.volumeTick > maxVol) { xTo = xOf + wiCl - 1; } else if (tk.volumeTick > minVol) { xTo = xOf + ((tk.volumeTick * 100 / minVol) * (wiCl / 2 - 1)) / 100; } else { xTo = xOf + ((tk.volumeTick * 100 / minVol) * (wiCl / 3 - 1)) / 100; } if (xTo == xOf) { xTo++; } Bars.Last().Value.Price.Add(tk.priceTick, new int[4] { xOf, xTo, yTo, tk.volumeTick }); } } lastPrice = tk.priceTick; lastPriceY = yTo + hiCl / 2; lastPriceX = xOf + wiCl; Load = true; }