void UpdateJournalData()
{
if (!Data.IsResult)
return;
Order[] aOrders = new Order[orders];
aiOrderIcons = new Image[orders];
int ordIndex = 0;
for (int point = 0; point < Backtester.WayPoints(selectedBar); point++)
{
int iOrdNumber = Backtester.WayPoint(selectedBar, point).OrdNumb;
WayPointType wpType = Backtester.WayPoint(selectedBar, point).WPType;
if (iOrdNumber == -1) continue; // There is no order
if (iOrdNumber < Backtester.OrdNumb(selectedBar, 0)) continue; // For a transferred position
if (wpType == WayPointType.Add || wpType == WayPointType.Cancel ||
wpType == WayPointType.Entry || wpType == WayPointType.Exit ||
wpType == WayPointType.Reduce || wpType == WayPointType.Reverse)
{
aOrders[ordIndex] = Backtester.OrdFromNumb(iOrdNumber);
ordIndex++;
}
}
for (int ord = 0; ord < orders; ord++)
{
int ordNumber = Backtester.OrdNumb(selectedBar, ord);
bool toIncluded = true;
for (int i = 0; i < ordIndex; i++)
{
if (ordNumber == aOrders[i].OrdNumb)
{
toIncluded = false;
break;
}
}
if (toIncluded)
{
aOrders[ordIndex] = Backtester.OrdFromNumb(ordNumber);
ordIndex++;
}
}
asJournalData = new string[orders, columns];
for (int ord = firstOrd; ord < firstOrd + shownOrd; ord++)
{
int row = ord - firstOrd;
string ordIF = (aOrders[ord].OrdIF > 0 ? (aOrders[ord].OrdIF + 1).ToString() : "-");
string ordPrice2 = (aOrders[ord].OrdPrice2 > 0 ? aOrders[ord].OrdPrice2.ToString(Data.FF) : "-");
asJournalData[row, 0] = (aOrders[ord].OrdNumb + 1).ToString();
asJournalData[row, 1] = Language.T(aOrders[ord].OrdDir.ToString());
asJournalData[row, 2] = Language.T(aOrders[ord].OrdType.ToString());
if (Configs.AccountInMoney)
{
string sOrdAmount = (aOrders[ord].OrdDir == OrderDirection.Sell ? "-" : "") +
(aOrders[ord].OrdLots * Data.InstrProperties.LotSize).ToString();
asJournalData[row, 3] = sOrdAmount;
}
else
asJournalData[row, 3] = aOrders[ord].OrdLots.ToString();
asJournalData[row, 4] = aOrders[ord].OrdPrice.ToString(Data.FF);
asJournalData[row, 5] = ordPrice2;
asJournalData[row, 6] = Language.T(aOrders[ord].OrdStatus.ToString());
asJournalData[row, 7] = aOrders[ord].OrdNote;
// Icons
aiOrderIcons[row] = aOrders[ord].OrderIcon;
}
return;
}