Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about OnBarUpdate()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Question about OnBarUpdate()

    Here's my code:
    Code:
    protected override void OnBarUpdate()
    {
        // Prints the current bar time stamp
        Print(Time[0].ToString());
    }
    Since CalculateOnBarClose is set to true as default, it's supposed to only print on the close of each bar. However, the output window continuously prints timestamps even the bar is not closed. Am i missing something?

    #2
    Hello misotrader,

    May we have a screenshot of the parameters for this indicator as its set on the chart?
    (So we can confirm that CalculateOnBarClose is set to True)

    Do you have a secondary series added to your script in Initialize()?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Sure

      Comment


        #4
        Hi misotrader,

        Thank you. This screenshot shows that a secondary data series has not been added to the script.

        May we have a screenshot of the parameters for this indicator as its set on the chart?
        Right-click the chart -> select Indicators... -> select the Indicator -> take a screenshot
        (So we can confirm that CalculateOnBarClose is set to True)

        Also, may we have the output from the output window?
        Right-click the Output window -> select Save As... -> give the file a name and save location
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Somehow the chart did not pick up the updated parameter even it's compiled and rerun.
          I explicitly set CalculateOnBarClose to true in chart -> Indicators, now it works!

          Comment


            #6
            Hi misotrader,

            The default values set in Initialize() are only used when adding a new instance of the indicator to the chart. (So that if you change these values, it does not undo your changes)
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            603 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            349 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            104 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            560 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X