public static void AddData(IndicatorCommand _lastIndicatorCommand, double _xAll, double _yAsk, double _yBid) { if (areasList.Count == 0 || (areasList[areasList.Count - 1].lastIndicatorCommand != _lastIndicatorCommand && _lastIndicatorCommand != IndicatorCommand.none)) { areasList.Add(new GraphAreaForGlass(_lastIndicatorCommand, _xAll, _yAsk, _yBid)); } else { AddDataToCurrentItem(_lastIndicatorCommand, _xAll, _yAsk, _yBid); } }
private GraphAreaForGlass(IndicatorCommand _lastIndicatorCommand, double _xAll, double _yAsk, double _yBid) { lastIndicatorCommand = _lastIndicatorCommand; enterX = exitX = _xAll; switch (_lastIndicatorCommand) { case IndicatorCommand.none: break; case IndicatorCommand.up: minY = maxY = enterY = _yBid; break; case IndicatorCommand.down: minY = maxY = enterY = _yAsk; break; } }
private static void AddDataToCurrentItem(IndicatorCommand _lastIndicatorCommand, double _xAll, double _yAsk, double _yBid) { GraphAreaForGlass ga = areasList[areasList.Count - 1]; ga.exitX = _xAll; switch (ga.lastIndicatorCommand) { case IndicatorCommand.none: break; case IndicatorCommand.up: ga.maxY = Math.Max(ga.maxY, _yBid); ga.minY = Math.Min(ga.minY, _yBid); break; case IndicatorCommand.down: ga.maxY = Math.Max(ga.maxY, _yAsk); ga.minY = Math.Min(ga.minY, _yAsk); break; } }