void GenerateMouseTip(int barNumb)
{
barNumb = Math.Max(0, barNumb);
barNumb = Math.Min(chartBars - 1, barNumb);
int bar;
bar = firstBar + barNumb;
bar = Math.Min(Data.Bars - 1, bar);
string tip = "";
string tipBarInfo = "";
double mousePrice = (YBottom - mouseY) / YScale + minPrice;
if (Math.Abs(mousePrice - Data.Open[bar]) < 5 * Data.InstrProperties.Point)
{
tipBarInfo += " Open: " + Data.High[bar].ToString() + Environment.NewLine;
}
if (Math.Abs(mousePrice - Data.High[bar]) < 5 * Data.InstrProperties.Point)
{
tipBarInfo += " High: " + Data.High[bar].ToString() + Environment.NewLine;
}
if (Math.Abs(mousePrice - Data.Low[bar]) < 5 * Data.InstrProperties.Point)
{
tipBarInfo += " Low: " + Data.High[bar].ToString() + Environment.NewLine;
}
if (Math.Abs(mousePrice - Data.Close[bar])< 5 * Data.InstrProperties.Point)
{
tipBarInfo += " Close: " + Data.High[bar].ToString() + Environment.NewLine;
}
if (tipBarInfo != "")
{
tipBarInfo = "Bar information" + Environment.NewLine + tipBarInfo;
tip += tipBarInfo;
}
for (int slot = 0; slot < Data.Strategy.Slots; slot++)
{
if (Data.Strategy.Slot[slot] != null)
{
for (int comp = 0; comp < Data.Strategy.Slot[slot].Component.Length; comp++)
{
IndComponentType indDataTipe = Data.Strategy.Slot[slot].Component[comp].DataType;
if (indDataTipe == IndComponentType.CloseLongPrice ||
indDataTipe == IndComponentType.ClosePrice ||
indDataTipe == IndComponentType.CloseShortPrice ||
indDataTipe == IndComponentType.IndicatorValue ||
indDataTipe == IndComponentType.OpenClosePrice ||
indDataTipe == IndComponentType.OpenLongPrice ||
indDataTipe == IndComponentType.OpenPrice ||
indDataTipe == IndComponentType.OpenShortPrice
)
{
double dValue = Data.Strategy.Slot[slot].Component[comp].Value[bar];
if (Math.Abs(mousePrice - dValue) < 5 * Data.InstrProperties.Point)
{
double dl = Math.Abs(dValue);
string sFR = dl < 10 ? "F4" : dl < 100 ? "F3" : dl < 1000 ? "F2" : dl < 10000 ? "F1" : "F0";
tip += Data.Strategy.Slot[slot].Component[comp].CompName + ": " + dValue.ToString(sFR) + Environment.NewLine;
}
}
}
}
}
// Positions
int pos;
for (pos = 0; pos < Backtester.Positions(bar); pos++)
{
double orderPrice = Backtester.SummaryOrdPrice(bar);
double fPositionPrice = Backtester.SummaryPrice(bar);
if (Math.Abs(mousePrice - orderPrice) < 5 * Data.InstrProperties.Point) tip += "Order price: " + orderPrice.ToString() + Environment.NewLine;
if (Math.Abs(mousePrice - fPositionPrice) < 5 * Data.InstrProperties.Point) tip += "Positions price: " + fPositionPrice.ToString() + Environment.NewLine;
}
if (tip != "")
{
mouseTips.Show(tip, pnlPrice, mouseX + 10, mouseY + 10, 5000);
}
return;
}