Exemple #1
0
		public void Paint(Pad pad, double MinX, double MaxX, double MinY, double MaxY)
		{
			Pen pen = new Pen(this.color);
			int num1 = 0;
			double num2 = 0.0;
			double num3 = 0.0;
			int x1 = 0;
			int x2 = 0;
			int y1 = 0;
			int y2 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			DateTime datetime1 = new DateTime((long)MinX);
			DateTime datetime2 = new DateTime((long)MaxX);
			int num8 = !(datetime1 < this.FirstDateTime) ? this.GetIndex(datetime1) : 0;
			int num9 = !(datetime2 > this.LastDateTime) ? this.GetIndex(datetime2) : this.Count - 1;
			if (num8 < 0 || num9 < 0)
				return;
			for (int index = num8; index <= num9; ++index)
			{
				Trade trade = this[index];
				double num10 = (double)trade.DateTime.Ticks;
				double price = trade.Price;
				if (num1 != 0 && price != 0.0 && num3 != 0.0)
				{
					x1 = pad.ClientX(num2);
					y1 = pad.ClientY(num3);
					x2 = pad.ClientX(num10);
					y2 = pad.ClientY(price);
					if ((pad.IsInRange(num10, price) || pad.IsInRange(num2, num3)) && (x1 != num4 || x2 != num5 || (y1 != num6 || y2 != num7)))
						pad.Graphics.DrawLine(pen, x1, y1, x2, y2);
				}
				num4 = x1;
				num6 = y1;
				num5 = x2;
				num7 = y2;
				num2 = num10;
				num3 = price;
				++num1;
			}
		}
Exemple #2
0
		public virtual void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
		{
			Pen pen1 = new Pen(this.Color, (float)this.DrawWidth);
			int num1 = 0;
			double num2 = 0.0;
			double num3 = 0.0;
			int x1 = 0;
			int x2 = 0;
			int y1 = 0;
			int y2 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			DateTime dateTime1 = new DateTime((long)xMin);
			DateTime dateTime2 = new DateTime((long)xMax);
			int index1 = this.GetIndex(dateTime1, EIndexOption.Next);
			int index2 = this.GetIndex(dateTime2, EIndexOption.Prev);
			if (index1 == -1 || index2 == -1)
				return;
			switch (this.fDrawStyle)
			{
				case EDrawStyle.Line:
					for (int index3 = index1; index3 <= index2; ++index3)
					{
						DateTime dateTime3 = this.GetDateTime(index3);
						double num8 = (double)dateTime3.Ticks;
						double num9 = base[index3, 0];
						if (dateTime3 > this.splitDate)
							pen1 = new Pen(this.secondColor, (float)this.DrawWidth);
						if (num1 != 0)
						{
							x1 = pad.ClientX(num2);
							y1 = pad.ClientY(num3);
							x2 = pad.ClientX(num8);
							y2 = pad.ClientY(num9);
							if ((pad.IsInRange(num8, num9) || pad.IsInRange(num2, num3)) && (x1 != num4 || x2 != num5 || (y1 != num6 || y2 != num7)))
								pad.Graphics.DrawLine(pen1, x1, y1, x2, y2);
						}
						num4 = x1;
						num6 = y1;
						num5 = x2;
						num7 = y2;
						num2 = num8;
						num3 = num9;
						++num1;
					}
					break;
				case EDrawStyle.Bar:
					for (int index3 = index1; index3 <= index2; ++index3)
					{
						DateTime dateTime3 = this.GetDateTime(index3);
						double WorldX = (double)dateTime3.Ticks;
						double WorldY = base[index3, 0];
						if (dateTime3 > this.splitDate)
						{
							Pen pen2 = new Pen(this.secondColor, (float)this.fDrawWidth);
						}
						if (WorldY > 0.0)
							pad.Graphics.FillRectangle((Brush)new SolidBrush(this.fColor), pad.ClientX(WorldX) - (this.fDrawWidth + 1) / 2, pad.ClientY(WorldY), this.fDrawWidth + 1, pad.ClientY(0.0) - pad.ClientY(WorldY));
						else
							pad.Graphics.FillRectangle((Brush)new SolidBrush(this.fColor), pad.ClientX(WorldX) - (this.fDrawWidth + 1) / 2, pad.ClientY(0.0), this.fDrawWidth + 1, pad.ClientY(WorldY) - pad.ClientY(0.0));
					}
					break;
				case EDrawStyle.Circle:
					for (int index3 = index1; index3 <= index2; ++index3)
					{
						DateTime dateTime3 = this.GetDateTime(index3);
						double WorldX = (double)dateTime3.Ticks;
						double WorldY = base[index3, 0];
						SolidBrush solidBrush = !(dateTime3 > this.splitDate) ? new SolidBrush(this.fColor) : new SolidBrush(this.secondColor);
						pad.Graphics.FillEllipse((Brush)solidBrush, pad.ClientX(WorldX) - this.fDrawWidth / 2, pad.ClientY(WorldY) - this.fDrawWidth / 2, this.fDrawWidth, this.fDrawWidth);
					}
					break;
			}
		}
Exemple #3
0
		public override void Paint(Pad pad, double XMin, double XMax, double YMin, double YMax)
		{
			Pen pen1 = new Pen(this.Color);
			Pen pen2 = new Pen(this.Color);
			Pen pen3 = new Pen(this.CandleColor);
			Pen pen4 = new Pen(this.CandleBorderColor);
			Brush brush1 = new SolidBrush(this.CandleWhiteColor);
			Brush brush2 = new SolidBrush(this.CandleBlackColor);
			int num1 = 0;
			double num2 = 0.0;
			double num3 = 0.0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int x2 = 0;
			long num7 = 0L;
			long num8 = 0L;
			int num9 = 0;
			int num10 = 0;
			DateTime dateTime1 = new DateTime((long)XMin);
			DateTime dateTime2 = new DateTime((long)XMax);
			int num11 = !(dateTime1 < this.FirstDateTime) ? this.GetIndex(dateTime1, EIndexOption.Prev) : 0;
			int num12 = !(dateTime2 > this.LastDateTime) ? this.GetIndex(dateTime2, EIndexOption.Next) : this.Count - 1;
			if (num11 == -1 || num12 == -1)
				return;
			for (int i = num11; i <= num12; ++i)
			{
				Bar bar = this[i];
				long num13 = bar.BeginTime.Ticks;
				long num14 = bar.EndTime.Ticks;
				double num15 = (double)(num13 + (num14 - num13) / 2L);
				int num16 = pad.ClientX(num15);
				double high = bar.High;
				double low = bar.Low;
				double open = bar.Open;
				double close = bar.Close;
				Pen pen5 = pen2;
				if (bar.Color != Color.Empty)
					pen5 = new Pen(bar.Color);
				switch (this.ChartStyle)
				{
					case ChartStyle.Line:
						double num17 = close;
						if (num1 != 0)
						{
							num13 = (long)pad.ClientX(num2);
							num4 = pad.ClientY(num3);
							num14 = (long)pad.ClientX(num15);
							num5 = pad.ClientY(num17);
							if ((pad.IsInRange(num15, num17) || pad.IsInRange(num2, num3)) && (num13 != num7 || num14 != num8 || (num4 != num9 || num5 != num10)))
								pad.Graphics.DrawLine(pen1, (float)num13, (float)num4, (float)num14, (float)num5);
						}
						num7 = num13;
						num9 = num4;
						num8 = num14;
						num10 = num5;
						num2 = num15;
						num3 = num17;
						++num1;
						break;
					case ChartStyle.Bar:
						switch (this.BarWidthStyle)
						{
							case EWidthStyle.Pixel:
								num6 = pad.ClientX(num15) - this.BarWidth / 2;
								x2 = pad.ClientX(num15) + this.BarWidth / 2;
								break;
							case EWidthStyle.DateTime:
								num6 = pad.ClientX(num15 - (double)((long)this.BarWidth * 10000000L / 2L));
								x2 = pad.ClientX(num15 + (double)((long)this.BarWidth * 10000000L / 2L));
								break;
							case EWidthStyle.Auto:
								num6 = pad.ClientX((double)num13);
								x2 = pad.ClientX((double)num14);
								break;
						}
						pad.Graphics.DrawLine(pen5, num16, pad.ClientY(low), num16, pad.ClientY(high));
						if (open != 0.0)
							pad.Graphics.DrawLine(pen5, num16, pad.ClientY(open), num6, pad.ClientY(open));
						if (close != 0.0)
						{
							pad.Graphics.DrawLine(pen5, num16, pad.ClientY(close), x2, pad.ClientY(close));
							break;
						}
						else
							break;
					case ChartStyle.Candle:
						switch (this.CandleWidthStyle)
						{
							case EWidthStyle.Pixel:
								num6 = pad.ClientX(num15) - this.CandleWidth / 2;
								x2 = pad.ClientX(num15) + this.CandleWidth / 2;
								break;
							case EWidthStyle.DateTime:
								num6 = pad.ClientX(num15 - (double)((long)this.CandleWidth * 10000000L / 2L));
								x2 = pad.ClientX(num15 + (double)((long)this.CandleWidth * 10000000L / 2L));
								break;
							case EWidthStyle.Auto:
								num6 = pad.ClientX((double)num13);
								x2 = pad.ClientX((double)num14);
								break;
						}
						pad.Graphics.DrawLine(pen3, num16, pad.ClientY(low), num16, pad.ClientY(high));
						if (open != 0.0 && close != 0.0)
						{
							if (open > close)
							{
								int width = x2 - num6;
								int height = pad.ClientY(close) - pad.ClientY(open);
								if (height == 0)
									height = 1;
								pad.Graphics.FillRectangle(brush2, num6, pad.ClientY(open), width, height);
								break;
							}
							else
							{
								int width = x2 - num6;
								int height = pad.ClientY(open) - pad.ClientY(close);
								if (height == 0)
									height = 1;
								if (pad.ForeColor == this.CandleWhiteColor)
								{
									pad.Graphics.DrawRectangle(pen4, num6, pad.ClientY(close), width, height);
									pad.Graphics.FillRectangle(brush1, num6 + 1, pad.ClientY(close) + 1, width - 2, height - 1);
									break;
								}
								else
								{
									pad.Graphics.FillRectangle(brush1, num6, pad.ClientY(close), width, height);
									break;
								}
							}
						}
						else
							break;
				}
			}
		}
Exemple #4
0
		public void Paint(Pad pad, double MinX, double MaxX, double MinY, double MaxY)
		{
			Pen pen1 = new Pen(this.askColor);
			Pen pen2 = new Pen(this.bidColor);
			int num1 = 0;
			double num2 = 0.0;
			double num3 = 0.0;
			double num4 = 0.0;
			int x1_1 = 0;
			int x2_1 = 0;
			int y1_1 = 0;
			int y2_1 = 0;
			int y1_2 = 0;
			int y2_2 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			int num8 = 0;
			int num9 = 0;
			int num10 = 0;
			DateTime datetime1 = new DateTime((long)MinX);
			DateTime datetime2 = new DateTime((long)MaxX);
			int num11 = !(datetime1 < this.FirstDateTime) ? this.GetIndex(datetime1) : 0;
			int num12 = !(datetime2 > this.LastDateTime) ? this.GetIndex(datetime2) : this.Count - 1;
			if (num11 < 0 || num12 < 0)
				return;
			for (int index = num11; index <= num12; ++index)
			{
				Quote quote = this[index];
				double num13 = (double)quote.DateTime.Ticks;
				double ask = quote.Ask;
				double bid = quote.Bid;
				if (num1 != 0)
				{
					int x1_2 = pad.ClientX(num2);
					y1_1 = pad.ClientY(num3);
					int x2_2 = pad.ClientX(num13);
					y2_1 = pad.ClientY(ask);
					if (ask != 0.0 && num3 != 0.0 && (pad.IsInRange(num13, ask) || pad.IsInRange(num2, num3)) && (x1_2 != num5 || x2_2 != num6 || (y1_1 != num7 || y2_1 != num8)))
						pad.Graphics.DrawLine(pen1, x1_2, y1_1, x2_2, y2_1);
					x1_1 = pad.ClientX(num2);
					y1_2 = pad.ClientY(num4);
					x2_1 = pad.ClientX(num13);
					y2_2 = pad.ClientY(bid);
					if (bid != 0.0 && num4 != 0.0 && (pad.IsInRange(num13, bid) || pad.IsInRange(num2, num4)) && (x1_1 != num5 || x2_1 != num6 || (y1_2 != num9 || y2_2 != num10)))
						pad.Graphics.DrawLine(pen2, x1_1, y1_2, x2_1, y2_2);
				}
				num7 = y1_1;
				num8 = y2_1;
				num3 = ask;
				num5 = x1_1;
				num9 = y1_2;
				num6 = x2_1;
				num10 = y2_2;
				num2 = num13;
				num4 = bid;
				++num1;
			}
		}
Exemple #5
0
		public override void Paint(Pad pad, double xMin, double xMax, double yMin, double yMax)
		{
			Pen pen = new Pen(this.Color, this.fDrawWidth);
			Brush brush = new SolidBrush(this.Color);
			int num1 = 0;
			double num2 = 0.0;
			double num3 = 0.0;
			int x1 = 0;
			int x2 = 0;
			int y1 = 0;
			int y2 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			DateTime dateTime1 = new DateTime((long)xMin);
			DateTime dateTime2 = new DateTime((long)xMax);
			int num8 = !(dateTime1 < this.FirstDateTime) ? this.GetIndex(dateTime1, EIndexOption.Next) : this.fFirstIndex;
			int num9 = !(dateTime2 > this.LastDateTime) ? this.GetIndex(dateTime2, EIndexOption.Prev) : this.fLastIndex;
			if (num8 == -1 || num9 == -1)
				return;
			switch (this.fDrawStyle)
			{
				case EDrawStyle.Line:
					for (int index = num8; index <= num9; ++index)
					{
						double num10 = (double)this.GetDateTime(index).Ticks;
						double num11 = ((TimeSeries)this)[index, 0];
						if (num1 != 0)
						{
							x1 = pad.ClientX(num2);
							y1 = pad.ClientY(num3);
							x2 = pad.ClientX(num10);
							y2 = pad.ClientY(num11);
							if ((pad.IsInRange(num10, num11) || pad.IsInRange(num2, num3)) && (x1 != num4 || x2 != num5 || (y1 != num6 || y2 != num7)))
								pad.Graphics.DrawLine(pen, x1, y1, x2, y2);
						}
						num4 = x1;
						num6 = y1;
						num5 = x2;
						num7 = y2;
						num2 = num10;
						num3 = num11;
						++num1;
					}
					break;
				case EDrawStyle.Bar:
					for (int index = num8; index <= num9; ++index)
					{
						double WorldX = (double)this.GetDateTime(index).Ticks;
						double WorldY = ((TimeSeries)this)[index, 0];
						if (WorldY > 0.0)
							pad.Graphics.FillRectangle((Brush)new SolidBrush(this.Color), pad.ClientX(WorldX) - this.fDrawWidth / 2, pad.ClientY(WorldY), this.fDrawWidth, pad.ClientY(0.0) - pad.ClientY(WorldY));
						else
							pad.Graphics.FillRectangle((Brush)new SolidBrush(this.Color), pad.ClientX(WorldX) - this.fDrawWidth / 2, pad.ClientY(0.0), this.fDrawWidth, pad.ClientY(WorldY) - pad.ClientY(0.0));
					}
					break;
				case EDrawStyle.Circle:
					for (int index = num8; index <= num9; ++index)
					{
						double WorldX = (double)this.GetDateTime(index).Ticks;
						double WorldY = ((TimeSeries)this)[index, 0];
						pad.Graphics.FillEllipse(brush, pad.ClientX(WorldX) - this.fDrawWidth / 2, pad.ClientY(WorldY) - this.fDrawWidth / 2, this.fDrawWidth, this.fDrawWidth);
					}
					break;
			}
		}