Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT7B6 Indicators: Non-displayed daily bars - yesterday's OnBarUpdate is out of sync

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

    NT7B6 Indicators: Non-displayed daily bars - yesterday's OnBarUpdate is out of sync

    I have multi-timeframe indicators which are applied to intraday charts, but they utilize daily data as well as intraday. They Add() a daily bar series, which is not displayed on the chart.

    This works fine on historical data; bar timing is what you would expect - at the end of each day, OnBarUpdate is called for the Daily bars in sync with the Intraday bar that closed at the same time.

    When the indicator is applied to a live chart, OnBarUpdate for yesterday's close is often called at the wrong time. Instead of being called in sync with yesterday's final intraday bar, it's called after all of today's intraday bars are processed.

    So, if you apply the indicator at 11 AM today, OnBarUpdate will be called for all of today's intraday bars up to 11:00 AM THEN OnBarUpdate is called for yesterday's daily bar.

    Because the daily bars are used in the indicator calculation, the indicator output will change based on when the indicator is applied.

    If the daily bars for the instrument are displayed as a data series on the chart, then OnBarUpdate for yesterday's daily bar is called at the correct time.

    How to reproduce:

    1. During trading hours, create an intraday chart for a stock (i.e. 6 days of 5-min SPY)
    2. Add a Daily Data Series for the same instrument (i.e. 6 days of 1-Day SPY)
    3. Open an output window.
    4. Apply the indicator TestDailySync (attached)
    5. Observe that the indicator output, and the output window, show that yesterday's daily OnBarUpdate was called at the correct time.
    6. Now remove the daily data series from the chart and refresh the indicator.
    7. Observe that yesterday's daily OnBarUpdate was not called at the correct time. It will not be called until the next close of an intraday bar. The indicator output has changed and is now incorrect (you may need to reapply the indicator several times to see this)

    Code:
    BarsInProgress == 0: 1/14/2010 11:05:00 AM
    BarsInProgress == 0: 1/14/2010 11:10:00 AM
    BarsInProgress == 0: 1/14/2010 11:15:00 AM
    BarsInProgress == 0: 1/14/2010 11:20:00 AM
    BarsInProgress == 0: 1/14/2010 11:25:00 AM
    BarsInProgress == 1: 1/13/2010 1:00:00 PM, counter = 2, Closes[1][0] = 114.62
    Attached Files

    #2
    Thanks. We will look into it.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      kdoren,

      This is expected. The reason this happens is because you are using CalculateOnBarClose = true. When you use this, the daily bar has not closed till it receives a live tick in the new date's day. To receive that tick comes when the strategy goes live. If you switch to CalculateOnBarClose = false it will get that update earlier and then you will be able to get the event where you were expecting it.
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

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