Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

State.Historical

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

    State.Historical

    I would have expected things like Bars.Count to be the same when OnStateChanged() is called for State.Historical as they are in OnBarUpdate(). They are not.

    I don't know whether that is a bug or a feature. It does inhibit moving some calculations from OnBarUpdate() to Historical, where they would be done only once.

    --EV

    #2
    This is a consequence of the improved architecture. In NinjaTrader 7 there was a 'transition' period where ticks could come inflight while the indicator/strategy was starting and we would essentially miss these data points. This has been addressed in NinjaTrader 8, but as a result it's expected that you can run into a situation (depending on market conditions) that there are more bars added to the bars array between the time it is processing OnStateChange() and the OnBarUpdate() method, etc.

    For example, this is something from a test case worked recently where this behavior was noted:

    OnStateChange(): State.Historical: Bars.Count=572
    OnBarUpdate(): State.Historical: Bars.Count=576
    ...
    OnStateChange(): State.Realtime: Bars.Count=576
    OnBarUpdate(): State.Realtime: Bars.Count=577
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

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