/// <summary> /// Updates the journal data from the backtester /// </summary> private void UpdateJournalData() { if (!Data.IsResult) { return; } journalData = new string[positions, columns]; positionIcons = new Image[shownPos]; for (int pos = firstPos; pos < firstPos + shownPos; pos++) { int row = pos - firstPos; journalData[row, 0] = (StatsBuffer.PosNumb(SelectedBar, pos) + 1).ToString(CultureInfo.InvariantCulture); journalData[row, 1] = Language.T(StatsBuffer.PosTransaction(SelectedBar, pos).ToString()); journalData[row, 2] = Language.T(StatsBuffer.PosDir(SelectedBar, pos).ToString()); journalData[row, 3] = Configs.AccountInMoney ? (StatsBuffer.PosDir(SelectedBar, pos) == PosDirection.Short ? "-" : "") + (StatsBuffer.PosLots(SelectedBar, pos) * Data.InstrProperties.LotSize) : StatsBuffer.PosLots(SelectedBar, pos).ToString(CultureInfo.InvariantCulture); journalData[row, 4] = (StatsBuffer.PosOrdNumb(SelectedBar, pos) + 1).ToString(CultureInfo.InvariantCulture); journalData[row, 5] = StatsBuffer.PosOrdPrice(SelectedBar, pos).ToString(Data.Ff); journalData[row, 6] = StatsBuffer.PosPrice(SelectedBar, pos).ToString(Data.Ff); // Profit Loss if (StatsBuffer.PosTransaction(SelectedBar, pos) == Transaction.Close || StatsBuffer.PosTransaction(SelectedBar, pos) == Transaction.Reduce || StatsBuffer.PosTransaction(SelectedBar, pos) == Transaction.Reverse) { journalData[row, 7] = Configs.AccountInMoney ? StatsBuffer.PosMoneyProfitLoss(SelectedBar, pos).ToString("F2") : Math.Round(StatsBuffer.PosProfitLoss(SelectedBar, pos)) .ToString(CultureInfo.InvariantCulture); } else { journalData[row, 7] = "-"; } // Floating Profit Loss if (pos == positions - 1 && StatsBuffer.PosTransaction(SelectedBar, pos) != Transaction.Close) { // Last bar position only journalData[row, 8] = Configs.AccountInMoney ? StatsBuffer.PosMoneyFloatingPL(SelectedBar, pos).ToString("F2") : Math.Round(StatsBuffer.PosFloatingPL(SelectedBar, pos)) .ToString(CultureInfo.InvariantCulture); } else { journalData[row, 8] = "-"; } // Icons positionIcons[row] = Position.PositionIconImage(StatsBuffer.PosIcon(SelectedBar, pos)); } }