Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does Strategy OnBarUpdate Run Before Indicator on Same Chart

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

    Does Strategy OnBarUpdate Run Before Indicator on Same Chart

    I’d like to clarify the execution order of OnBarUpdate when both a strategy and an indicator are loaded on the same chart in NinjaTrader 8.

    If I have both a strategy and a custom indicator applied to the same chart (regardless of which one I add first), will the chart always execute the strategy’s OnBarUpdate before the indicator’s OnBarUpdate on each new tick or bar? From my testing, this is what I am seeing.

    Here’s the context:

    I’m using a custom indicator to process signals and store them into a shared ConcurrentDictionary (think of it like a signal hub). My strategy then reads from this dictionary to generate entries. I want to test multiple strategy variations at the same time without duplicating the indicator logic inside each strategy, to keep things CPU-efficient.

    The concern is timing — I need to ensure that the indicator has populated the dictionary before the strategy reads from it on the same bar.

    Can anyone confirm the execution order, or suggest a reliable way to ensure this timing relationship?

    Thanks!

    #2
    Hello cutzpr,

    A strategy has no relation to the indicator on the chart, they are not in sync. Only if you used AddChartIndicator in the strategies code will that be relevant. If you use AddChartIndicator then the instance being used should process before the strategy so the strategy can get a value.

    I would suggest using a more simple test script to make an indicator that reports 1 or 0 if a condition is true and then read that series<int> or plot from the strategy. That should result in the strategy getting the indicators most recent closed bar value if you used 0 bars ago.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    547 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    323 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    99 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
    545 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X