void SetupDynInfoWidth()
{
asInfoTitle = new string[200];
aiInfoType = new int[200];
infoRows = 0;
string sUnit = " [" + (Configs.AccountInMoney ? Configs.AccountCurrency : Language.T("pips")) + "]";
// Dynamic info titles
asInfoTitle[infoRows++] = Language.T("Bar number");
asInfoTitle[infoRows++] = Language.T("Date");
asInfoTitle[infoRows++] = Language.T("Opening time");
asInfoTitle[infoRows++] = Language.T("Opening price");
asInfoTitle[infoRows++] = Language.T("Highest price");
asInfoTitle[infoRows++] = Language.T("Lowest price");
asInfoTitle[infoRows++] = Language.T("Closing price");
asInfoTitle[infoRows++] = Language.T("Volume");
asInfoTitle[infoRows++] = Language.T("Balance") + sUnit;
asInfoTitle[infoRows++] = Language.T("Equity") + sUnit;
asInfoTitle[infoRows++] = Language.T("Profit Loss") + sUnit;
asInfoTitle[infoRows++] = Language.T("Floating P/L") + sUnit;
for (int iSlot = 0; iSlot < Data.Strategy.Slots; iSlot++)
{
int iCompToShow = 0;
foreach (IndicatorComp indComp in Data.Strategy.Slot[iSlot].Component)
if (indComp.ShowInDynInfo) iCompToShow++;
if (iCompToShow == 0) continue;
aiInfoType[infoRows] = 1;
asInfoTitle[infoRows++] = Data.Strategy.Slot[iSlot].IndicatorName +
(Data.Strategy.Slot[iSlot].IndParam.CheckParam[0].Checked ? "*" : "");
foreach (IndicatorComp indComp in Data.Strategy.Slot[iSlot].Component)
if (indComp.ShowInDynInfo) asInfoTitle[infoRows++] = indComp.CompName;
}
asInfoTitle[infoRows++] = "";
asInfoTitle[infoRows++] = Language.T("Position direction");
asInfoTitle[infoRows++] = Language.T("Number of open lots");
asInfoTitle[infoRows++] = Language.T("Type of the transaction");
asInfoTitle[infoRows++] = Language.T("Forming order number");
asInfoTitle[infoRows++] = Language.T("Forming order price");
asInfoTitle[infoRows++] = Language.T("Corrected position price");
asInfoTitle[infoRows++] = Language.T("Profit Loss") + sUnit;
asInfoTitle[infoRows++] = Language.T("Floating P/L") + sUnit;
Graphics g = CreateGraphics();
int iMaxLenght = 0;
foreach (string str in asInfoTitle)
{
int iLenght = (int)g.MeasureString(str, fontDI).Width;
if (iMaxLenght < iLenght) iMaxLenght = iLenght;
}
XDynInfoCol2 = iMaxLenght + 10;
int iMaxInfoWidth = Configs.AccountInMoney ?
(int)Math.Max(g.MeasureString(Backtester.MinMoneyEquity.ToString("F2"), fontDI).Width,
g.MeasureString(Backtester.MaxMoneyEquity.ToString("F2"), fontDI).Width) :
(int)Math.Max(g.MeasureString(Backtester.MinEquity.ToString(), fontDI).Width,
g.MeasureString(Backtester.MaxEquity.ToString(), fontDI).Width);
iMaxInfoWidth = (int)Math.Max(g.MeasureString("99/99/99", fontDI).Width, iMaxInfoWidth);
foreach (PosDirection posDir in Enum.GetValues(typeof(PosDirection)))
if (g.MeasureString(Language.T(posDir.ToString()), fontDI).Width > iMaxInfoWidth)
iMaxInfoWidth = (int)g.MeasureString(Language.T(posDir.ToString()), fontDI).Width;
foreach (Transaction transaction in Enum.GetValues(typeof(Transaction)))
if (g.MeasureString(Language.T(transaction.ToString()), fontDI).Width > iMaxInfoWidth)
iMaxInfoWidth = (int)g.MeasureString(Language.T(transaction.ToString()), fontDI).Width;
g.Dispose();
dynInfoWidth = XDynInfoCol2 + iMaxInfoWidth + (isDEBUG ? 40 : 5);
int iPasiveWidth = szInfoHelp.Width + 5;
if (iPasiveWidth > dynInfoWidth)
{
XDynInfoCol2 += (iPasiveWidth - dynInfoWidth) / 2;
dynInfoWidth = iPasiveWidth;
}
pnlInfo.ClientSize = new Size(dynInfoWidth, pnlInfo.ClientSize.Height);
isDrawDinInfo = false;
return;
}