/// <summary> /// Updates the journal data from the StatsBuffer. /// </summary> private void UpdateJournalData() { _journalData = new string[_shownPos, _columns]; _posIcons = new Image[_shownPos]; for (int posIndex = _firstPos; posIndex < _firstPos + _shownPos; posIndex++) { int posNumber = posIndex; if (!ShowTransfers) { posNumber = _posNumbers[posIndex]; } int row = posIndex - _firstPos; int bar = StatsBuffer.PosCoordinates[posNumber].Bar; Position position = StatsBuffer.PosFromNumb(posNumber); string posAmount = Configs.AccountInMoney ? (position.PosDir == PosDirection.Short ? "-" : "") + (position.PosLots * Data.InstrProperties.LotSize).ToString( CultureInfo.InvariantCulture) : position.PosLots.ToString(CultureInfo.InvariantCulture); string profitLoss = Configs.AccountInMoney ? position.MoneyProfitLoss.ToString("F2") : position.ProfitLoss.ToString("F2"); string floatingPL = Configs.AccountInMoney ? position.MoneyFloatingPL.ToString("F2") : position.FloatingPL.ToString("F2"); int p = 0; _journalData[row, p++] = (posNumber + 1).ToString(CultureInfo.InvariantCulture); _journalData[row, p++] = (bar + 1).ToString(CultureInfo.InvariantCulture); _journalData[row, p++] = Data.Time[bar].ToString(Data.DF) + Data.Time[bar].ToString(" HH:mm"); _journalData[row, p++] = Language.T(position.Transaction.ToString()); _journalData[row, p++] = Language.T(position.PosDir.ToString()); _journalData[row, p++] = posAmount; _journalData[row, p++] = position.FormOrdPrice.ToString(Data.FF); _journalData[row, p++] = position.PosPrice.ToString(Data.FF); _journalData[row, p++] = position.RequiredMargin.ToString("F2"); // Charges if (Configs.AccountInMoney) { // in currency if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reverse) { _journalData[row, p++] = position.MoneySpread.ToString("F2"); } else { _journalData[row, p++] = "-"; } _journalData[row, p++] = position.Transaction == Transaction.Transfer ? position.MoneyRollover.ToString("F2") : "-"; if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Close || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { _journalData[row, p++] = position.MoneyCommission.ToString("F2"); _journalData[row, p++] = position.MoneySlippage.ToString("F2"); } else { _journalData[row, p++] = "-"; _journalData[row, p++] = "-"; } } else { // In pips if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reverse) { _journalData[row, p++] = position.Spread.ToString(CultureInfo.InvariantCulture); } else { _journalData[row, p++] = "-"; } _journalData[row, p++] = position.Transaction == Transaction.Transfer ? position.Rollover.ToString("F2") : "-"; if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Close || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { _journalData[row, p++] = position.Commission.ToString("F2"); _journalData[row, p++] = position.Slippage.ToString(CultureInfo.InvariantCulture); } else { _journalData[row, p++] = "-"; _journalData[row, p++] = "-"; } } // Profit Loss if (position.Transaction == Transaction.Close || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { _journalData[row, p++] = profitLoss; } else { _journalData[row, p++] = "-"; } // Floating Profit Loss if (position.PosNumb == StatsBuffer.SummaryPosNumb(bar) && position.Transaction != Transaction.Close) { _journalData[row, p++] = floatingPL; //Last position of the bar only } else { _journalData[row, p++] = "-"; } // Balance / Equity if (Configs.AccountInMoney) { _journalData[row, p++] = position.MoneyBalance.ToString("F2"); _journalData[row, p++] = position.MoneyEquity.ToString("F2"); } else { _journalData[row, p++] = position.Balance.ToString("F2"); _journalData[row, p++] = position.Equity.ToString("F2"); } _journalData[row, p] = Language.T(StatsBuffer.BackTestEvalToString(bar)); // Icons _posIcons[row] = Position.PositionIconImage(position.PositionIcon); } }