Forex_Strategy_Builder.Journal_Bars.SetUpJournal C# (CSharp) Method

SetUpJournal() public method

Sets the journal's current data
public SetUpJournal ( ) : void
return void
        public void SetUpJournal()
        {
            bars = Data.Bars;

            if (bars == 0)
            {
                firstBar  = 0;
                lastBar   = 0;
                shownBars = 0;

                vScrollBar.Enabled = false;
            }
            else if (bars < rows)
            {
                firstBar  = 0;
                lastBar   = rows;
                shownBars = bars;

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

                firstBar = vScrollBar.Value;
                if (firstBar + rows > bars)
                {
                    lastBar   = bars - 1;
                    shownBars = lastBar - firstBar + 1;
                }
                else
                {
                    shownBars = rows;
                    lastBar   = firstBar + shownBars - 1;
                }
            }

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

            UpdateJournalData();
            SetJournalColors();

            return;
        }

Usage Example

        /// <summary>
        /// Sets the journal data
        /// </summary>
        protected void SetupJournal()
        {
            if (Configs.ShowJournal)
            {
                if (Configs.JournalByBars)
                {
                    pnlJournalByBars.SetUpJournal();
                    pnlJournalByBars.Invalidate();
                    selectedBar = pnlJournalByBars.SelectedBar;
                    pnlJournalOrder.SelectedBar = selectedBar;
                    pnlJournalOrder.SetUpJournal();
                    pnlJournalOrder.Invalidate();
                    pnlJournalPosition.SelectedBar = selectedBar;
                    pnlJournalPosition.SetUpJournal();
                    pnlJournalPosition.Invalidate();
                }
                else
                {
                    pnlJournalByPositions.ShowTransfers = Configs.JournalShowTransfers;
                    pnlJournalByPositions.SetUpJournal();
                    pnlJournalByPositions.Invalidate();
                    selectedBar = pnlJournalByBars.SelectedBar;
                }
            }

            return;
        }