/// <summary>
        /// Sets the journal's current data
        /// </summary>
        public void SetUpJournal()
        {
            if (showTransfers)
            {
                positions = Backtester.PositionsTotal;
            }
            else
            {
                if (Backtester.PositionsTotal > 0)
                {
                    aiPosNumber = new int[Backtester.PositionsTotal];
                }
                else
                {
                    aiPosNumber = new int[1];
                }

                positions = 0;
                for (int bar = 0; bar < Data.Bars; bar++)
                {
                    for (int pos = 0; pos < Backtester.Positions(bar); pos++)
                    {
                        Transaction transaction = Backtester.PosTransaction(bar, pos);
                        if (transaction != Transaction.None && transaction != Transaction.Transfer)
                        {
                            aiPosNumber[positions] = Backtester.PosNumb(bar, pos);
                            positions++;
                        }
                    }
                }
            }

            if (positions == 0)
            {
                firstPos    = 0;
                lastPos     = 0;
                shownPos    = 0;
                selectedRow = 0;

                vScrollBar.Enabled = false;
            }
            else if (positions < rows)
            {
                firstPos    = 0;
                lastPos     = rows;
                shownPos    = positions;
                selectedRow = 0;

                vScrollBar.Enabled = false;
            }
            else
            {
                vScrollBar.Enabled = true;
                vScrollBar.Maximum = positions - 1;

                firstPos = vScrollBar.Value;
                if (firstPos + rows > positions)
                {
                    lastPos  = positions - 1;
                    shownPos = lastPos - firstPos + 1;
                }
                else
                {
                    shownPos = rows;
                    lastPos  = firstPos + shownPos - 1;
                }
            }

            selectedRow = Math.Min(selectedRow, shownPos - 1);
            selectedRow = Math.Max(selectedRow, 0);

            UpdateJournalData();
            SetJournalColors();

            return;
        }
        /// <summary>
        /// Updates the journal data from the backtester
        /// </summary>
        void UpdateJournalData()
        {
            if (!Data.IsResult)
            {
                return;
            }

            asJournalData   = new string[positions, columns];
            aiPositionIcons = new Image[shownPos];

            for (int pos = firstPos; pos < firstPos + shownPos; pos++)
            {
                int row = pos - firstPos;

                asJournalData[row, 0] = (Backtester.PosNumb(selectedBar, pos) + 1).ToString();
                asJournalData[row, 1] = Language.T(Backtester.PosTransaction(selectedBar, pos).ToString());
                asJournalData[row, 2] = Language.T(Backtester.PosDir(selectedBar, pos).ToString());
                string sOrdAmount;
                if (Configs.AccountInMoney)
                {
                    sOrdAmount = (Backtester.PosDir(selectedBar, pos) == PosDirection.Short ? "-" : "") +
                                 (Backtester.PosLots(selectedBar, pos) * Data.InstrProperties.LotSize).ToString();
                }
                else
                {
                    sOrdAmount = Backtester.PosLots(selectedBar, pos).ToString();
                }
                asJournalData[row, 3] = sOrdAmount;
                asJournalData[row, 4] = (Backtester.PosOrdNumb(selectedBar, pos) + 1).ToString();
                asJournalData[row, 5] = Backtester.PosOrdPrice(selectedBar, pos).ToString(Data.FF);
                asJournalData[row, 6] = Backtester.PosPrice(selectedBar, pos).ToString(Data.FF);

                // Profit Loss
                if (Backtester.PosTransaction(selectedBar, pos) == Transaction.Close ||
                    Backtester.PosTransaction(selectedBar, pos) == Transaction.Reduce ||
                    Backtester.PosTransaction(selectedBar, pos) == Transaction.Reverse)
                {
                    string sProfitLoss;
                    if (Configs.AccountInMoney)
                    {
                        sProfitLoss = Backtester.PosMoneyProfitLoss(selectedBar, pos).ToString("F2");
                    }
                    else
                    {
                        sProfitLoss = Math.Round(Backtester.PosProfitLoss(selectedBar, pos)).ToString();
                    }
                    asJournalData[row, 7] = sProfitLoss;
                }
                else
                {
                    asJournalData[row, 7] = "-";
                }

                // Floating Profit Loss
                if (pos == positions - 1 && Backtester.PosTransaction(selectedBar, pos) != Transaction.Close)
                { // Last bar position only
                    string sFloatingPL;
                    if (Configs.AccountInMoney)
                    {
                        sFloatingPL = Backtester.PosMoneyFloatingPL(selectedBar, pos).ToString("F2");
                    }
                    else
                    {
                        sFloatingPL = Math.Round(Backtester.PosFloatingPL(selectedBar, pos)).ToString();
                    }
                    asJournalData[row, 8] = sFloatingPL;
                }
                else
                {
                    asJournalData[row, 8] = "-";
                }

                // Icons
                aiPositionIcons[row] = Backtester.PosIcon(selectedBar, pos);
            }

            return;
        }