public TDistance Distance(double x, double y) { var d = new TDistance(); d.X = X; d.Y = Y; d.dX = Math.Abs(x - X); d.dY = Math.Abs(y - Y); d.ToolTipText = string.Format(ToolTipFormat, X, Y); return d; }
public virtual TDistance Distance(double x, double y) { TDistance d = new TDistance(); d.X = X; d.Y = Y; d.dX = Math.Abs(x - X); d.dY = Math.Abs(y - Y); d.ToolTipText = string.Format(ToolTipFormat, X, Y); return(d); }
public TDistance Distance(double x, double y) { var d = new TDistance(); foreach (TMarker marker in Points) { var d2 = marker.Distance(x, y); if (d2.dX < d.dX && d2.dY < d.dY) { d = d2; } } if (d != null) { d.ToolTipText = string.Format(ToolTipFormat, Name, Title, d.X, d.Y); } return(d); }
public TDistance Distance(double X, double Y) { DateTime now = Clock.Now; TDistance tDistance = new TDistance(); double num = Math.Abs(this.order.Price); tDistance.X = X; tDistance.Y = num; FIXExecutionReport fIXExecutionReport = null; if (this.order.Reports.Count != 0) { fIXExecutionReport = this.order.Reports[this.order.Reports.Count - 1]; } if (fIXExecutionReport == null) { return null; } if (this.order.OrdType == OrdType.Market && this.order.OrdStatus != OrdStatus.Filled) { return null; } StringBuilder stringBuilder = null; if (this.order.OrdType == OrdType.Market) { tDistance.X = (double)fIXExecutionReport.TransactTime.Ticks; tDistance.Y = fIXExecutionReport.Price; tDistance.dX = Math.Abs(X - tDistance.X); tDistance.dY = Math.Abs(Y - tDistance.Y); stringBuilder = new StringBuilder(); if (fIXExecutionReport.TransactTime.Second != 0 || fIXExecutionReport.TransactTime.Minute != 0 || fIXExecutionReport.TransactTime.Hour != 0) { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Market ", this.order.AvgPx, fIXExecutionReport.TransactTime }); } else { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Market ", this.order.AvgPx, fIXExecutionReport.TransactTime.ToShortDateString() }); } } if (this.order.OrdType == OrdType.Stop || this.order.OrdType == OrdType.StopLimit) { num = Math.Abs(this.order.StopPx); tDistance.X = X; tDistance.Y = num; DateTime transactTime = this.order.Reports[0].TransactTime; if (X >= (double)transactTime.Ticks && ((this.order.OrdStatus != OrdStatus.Filled && this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected && X <= (double)now.Ticks) || X <= (double)fIXExecutionReport.TransactTime.Ticks)) { tDistance.dX = 0.0; } else { tDistance.dX = 1.7976931348623157E+308; } tDistance.dY = Math.Abs(Y - tDistance.Y); stringBuilder = new StringBuilder(); if (transactTime.Second != 0 || transactTime.Minute != 0 || transactTime.Hour != 0) { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Stop At ", num, fIXExecutionReport.TransactTime }); } else { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Stop At ", num, fIXExecutionReport.TransactTime.ToShortDateString() }); } } if (this.order.OrdType == OrdType.Limit || this.order.OrdType == OrdType.StopLimit) { num = Math.Abs(this.order.Price); tDistance.X = X; tDistance.Y = num; DateTime transactTime2 = this.order.Reports[0].TransactTime; if (X >= (double)transactTime2.Ticks && ((this.order.OrdStatus != OrdStatus.Filled && this.order.OrdStatus != OrdStatus.Cancelled && this.order.OrdStatus != OrdStatus.Rejected && X <= (double)now.Ticks) || X <= (double)fIXExecutionReport.TransactTime.Ticks)) { tDistance.dX = 0.0; } else { tDistance.dX = 1.7976931348623157E+308; } if (tDistance.dY > Math.Abs(Y - tDistance.Y)) { tDistance.dY = Math.Abs(Y - tDistance.Y); stringBuilder = new StringBuilder(); if (transactTime2.Second != 0 || transactTime2.Minute != 0 || transactTime2.Hour != 0) { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Limit At ", num, fIXExecutionReport.TransactTime }); } else { stringBuilder.AppendFormat(this.toolTipFormat, new object[] { this.order.OrdStatus.ToString(), this.order.Side.ToString(), this.order.Instrument.Symbol, this.order.OrderQty, "Limit At ", num, fIXExecutionReport.TransactTime.ToShortDateString() }); } } } if (stringBuilder != null) { tDistance.ToolTipText = stringBuilder.ToString(); } return tDistance; }
public TDistance Distance(double x, double y) { var d = new TDistance(); foreach (TMarker marker in Points) { var d2 = marker.Distance(x, y); if (d2.dX < d.dX && d2.dY < d.dY) d = d2; } if (d != null) d.ToolTipText = string.Format(ToolTipFormat, Name, Title, d.X, d.Y); return d; }