private string GetPositionFloatingPLString(int bar)
 {
     if (StatsBuffer.SummaryTrans(bar) == Transaction.Close)
     {
         return("-");
     }
     return(Configs.AccountInMoney
                ? StatsBuffer.MoneyFloatingPL(bar).ToString("F2")
                : StatsBuffer.FloatingPL(bar).ToString(CultureInfo.InvariantCulture));
 }
        private string GetPositionProfitString(int bar)
        {
            Transaction trans = StatsBuffer.SummaryTrans(bar);

            if (trans == Transaction.Close || trans == Transaction.Reduce || trans == Transaction.Reverse)
            {
                return(Configs.AccountInMoney
                           ? StatsBuffer.MoneyProfitLoss(bar).ToString("F2")
                           : StatsBuffer.ProfitLoss(bar).ToString(CultureInfo.InvariantCulture));
            }
            return("-");
        }
        /// <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;
            }
        }