/// <summary>
        /// Updates the journal data from StatsBuffer
        /// </summary>
        public void UpdateJournalData()
        {
            _journalData   = new string[_shownBars, _columns];
            _positionIcons = new Image[_shownBars];

            for (int bar = _firstBar; bar < _firstBar + _shownBars; bar++)
            {
                int  row     = bar - _firstBar;
                int  col     = 0;
                bool isPos   = StatsBuffer.IsPos(bar);
                bool inMoney = Configs.AccountInMoney;

                _journalData[row, col++] = (bar + 1).ToString(CultureInfo.InvariantCulture);
                _journalData[row, col++] = Data.Time[bar].ToString(Data.DF);
                _journalData[row, col++] = Data.Time[bar].ToString("HH:mm");
                _journalData[row, col++] = Data.Open[bar].ToString(Data.FF);
                _journalData[row, col++] = Data.High[bar].ToString(Data.FF);
                _journalData[row, col++] = Data.Low[bar].ToString(Data.FF);
                _journalData[row, col++] = Data.Close[bar].ToString(Data.FF);
                _journalData[row, col++] = Data.Volume[bar].ToString(CultureInfo.InvariantCulture);
                _journalData[row, col++] = isPos ? Language.T(StatsBuffer.SummaryTrans(bar).ToString()) : "";
                _journalData[row, col++] = isPos ? Language.T(StatsBuffer.SummaryDir(bar).ToString()) : "";
                _journalData[row, col++] = isPos ? GetPositionAmmountString(bar) : "";
                _journalData[row, col++] = isPos ? StatsBuffer.SummaryPrice(bar).ToString(Data.FF) : "";
                _journalData[row, col++] = isPos ? GetPositionProfitString(bar) : "";
                _journalData[row, col++] = isPos ? GetPositionFloatingPLString(bar) : "";
                _journalData[row, col++] = inMoney
                                               ? StatsBuffer.MoneyBalance(bar).ToString("F2")
                                               : StatsBuffer.Balance(bar).ToString(CultureInfo.InvariantCulture);
                _journalData[row, col++] = inMoney
                                               ? StatsBuffer.MoneyEquity(bar).ToString("F2")
                                               : StatsBuffer.Equity(bar).ToString(CultureInfo.InvariantCulture);
                _journalData[row, col++] = StatsBuffer.SummaryRequiredMargin(bar).ToString("F2");
                _journalData[row, col++] = StatsBuffer.SummaryFreeMargin(bar).ToString("F2");
                _journalData[row, col]   = Language.T(StatsBuffer.BackTestEvalToString(bar));

                _positionIcons[row] = isPos
                                          ? Position.PositionIconImage(StatsBuffer.SummaryPositionIcon(bar))
                                          : Resources.pos_square;
            }
        }
        /// <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);
            }
        }