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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    135 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    293 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    238 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    333 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    171 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X