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 CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            26 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            20 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            182 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            335 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            260 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X