Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Redrawing Chart when New Bar Opens on 60 Min Chart

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

    Redrawing Chart when New Bar Opens on 60 Min Chart

    I have a custom Indicator drawing trendlines and other objects using the OnBarUpdate Event. However, when the chart is a 60 minute chart, it does not automatically update the chart when the hourly bar closes and a new one opens. I need the chart to re-evaluate every bar and redraw. Is there an event I can register for or a way to command OnBarUpdate to retrigger for every bar? I am bound to using Ninja Trader 7 for the time being. Please note when CalculateOnBarClose is true, the whole chart is not redrawing causing the last trendline to have two end points. when CalculateOnBarClose is false, nothing new redraws. I can handle these issues if I had an event for a bar closing or a bar opening.
    Last edited by mmckinnm; 04-23-2024, 01:48 PM.

    #2
    Hello mmckinnm,

    Welcome to the NinjaTrader forums!

    A bar closing would cause OnBarUpdate() to run and for the chart to re-draw to show the new bar opening.

    Are you referring to the last bar of the session, or bars closing during the session? (The last bar of a session closes when the new bar of a new session opens)

    Try printing the Time[0] of the bar at the top of OnBarUpdate().

    Do you see the print appearing in the output window when the new bar opens?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I think I added more details at the same time your were responding. I am referring to the new bars that appear every hour during trading hours in a 60 minute chart. Also, I do not believe OnBarUpdate is running for each and every bar for CalculateOnBar Close. I can attach to process with Visual Studio and verify this tomorrow when the market is open again.

      Comment


        #4
        Hello mmckinnm,

        Below is a link to a video that shows as long as a bar is closing and a new bar has opened, this will cause OnBarUpdate() to run.


        Using the attached test script and following the steps in the video exactly, are you seeing different behavior than what is shown in the video?
        Attached Files
        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
        553 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        100 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        543 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        546 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X