/// <summary> /// Updates the journal data from the backtester /// </summary> void UpdateJournalData() { asJournalData = new string[shownPos, columns]; aiPositionIcons = new Image[shownPos]; for (int posIndex = firstPos; posIndex < firstPos + shownPos; posIndex++) { int posNumber = posIndex; if (!showTransfers) { posNumber = aiPosNumber[posIndex]; } int row = posIndex - firstPos; int bar = Backtester.PosCoordinates[posNumber].Bar; Position position = Backtester.PosFromNumb(posNumber); string posAmount; if (Configs.AccountInMoney) { posAmount = (position.PosDir == PosDirection.Short ? "-" : "") + (position.PosLots * Data.InstrProperties.LotSize).ToString(); } else { posAmount = position.PosLots.ToString(); } string profitLoss; if (Configs.AccountInMoney) { profitLoss = position.MoneyProfitLoss.ToString("F2"); } else { profitLoss = position.ProfitLoss.ToString("F2"); } string floatingPL; if (Configs.AccountInMoney) { floatingPL = position.MoneyFloatingPL.ToString("F2"); } else { floatingPL = position.FloatingPL.ToString("F2"); } int p = 0; asJournalData[row, p++] = (posNumber + 1).ToString(); asJournalData[row, p++] = (bar + 1).ToString(); asJournalData[row, p++] = Data.Time[bar].ToString(Data.DF) + Data.Time[bar].ToString(" HH:mm"); asJournalData[row, p++] = Language.T(position.Transaction.ToString()); asJournalData[row, p++] = Language.T(position.PosDir.ToString()); asJournalData[row, p++] = posAmount; asJournalData[row, p++] = position.FormOrdPrice.ToString(Data.FF); asJournalData[row, p++] = position.PosPrice.ToString(Data.FF); asJournalData[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) { asJournalData[row, p++] = position.MoneySpread.ToString("F2"); } else { asJournalData[row, p++] = "-"; } if (position.Transaction == Transaction.Transfer) { asJournalData[row, p++] = position.MoneyRollover.ToString("F2"); } else { asJournalData[row, p++] = "-"; } if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Close || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { asJournalData[row, p++] = position.MoneyCommission.ToString("F2"); asJournalData[row, p++] = position.MoneySlippage.ToString("F2"); } else { asJournalData[row, p++] = "-"; asJournalData[row, p++] = "-"; } } else { // In pips if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reverse) { asJournalData[row, p++] = position.Spread.ToString(); } else { asJournalData[row, p++] = "-"; } if (position.Transaction == Transaction.Transfer) { asJournalData[row, p++] = position.Rollover.ToString("F2"); } else { asJournalData[row, p++] = "-"; } if (position.Transaction == Transaction.Open || position.Transaction == Transaction.Close || position.Transaction == Transaction.Add || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { asJournalData[row, p++] = position.Commission.ToString("F2"); asJournalData[row, p++] = position.Slippage.ToString(); } else { asJournalData[row, p++] = "-"; asJournalData[row, p++] = "-"; } } // Profit Loss if (position.Transaction == Transaction.Close || position.Transaction == Transaction.Reduce || position.Transaction == Transaction.Reverse) { asJournalData[row, p++] = profitLoss; } else { asJournalData[row, p++] = "-"; } // Floating Profit Loss if (position.PosNumb == Backtester.SummaryPosNumb(bar) && position.Transaction != Transaction.Close) { asJournalData[row, p++] = floatingPL; //Last position of the bar only } else { asJournalData[row, p++] = "-"; } // Balance / Equity if (Configs.AccountInMoney) { asJournalData[row, p++] = position.MoneyBalance.ToString("F2"); asJournalData[row, p++] = position.MoneyEquity.ToString("F2"); } else { asJournalData[row, p++] = position.Balance.ToString("F2"); asJournalData[row, p++] = position.Equity.ToString("F2"); } asJournalData[row, p++] = Language.T(Backtester.BackTestEval(bar)); // Icons aiPositionIcons[row] = position.PositionIcon; } return; }