Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Correction in the Code Breaking Changes Overview

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

  • molecool
    replied
    Originally posted by NinjaTrader_Matthew View Post
    Thanks for the feedback and discussion guys. We will review to make that point more clear.
    Thanks Matt - what's important is that you guys implemented this in the first place. I had to jump through a lot of hoops to differentiate between what I considered live and historical in NT7 - I'm sure you remember the pertinent threads. This makes the process rather trivial - assuming it works as expected.

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    Thanks for the feedback and discussion guys. We will review to make that point more clear.

    Leave a comment:


  • molecool
    replied
    Originally posted by koganam View Post
    Confusing I agree, until I thought of it this way. The State enum is a different and independent entity from the event handler/method OnStateChange(). We can query the State from anywhere that it is in scope, which pretty much means for all user classes, as the enum is declared way back in the NinjaScript namespace.
    Exactly - what he said. Probably part of this should be in the docs.

    Leave a comment:


  • koganam
    replied
    Originally posted by molecool View Post
    A small oversight apparently in the documentation:

    NinjaTrader previously used a Historical bool property to notify when an indicator or strategy bar was being processed historically or real-time. The NinjaTrader 8 OnStateChange() method has now introduced a concept of State.Historical or State.Realtime which will allow you to take action depending on the desired state:

    protected override void OnBarUpdate()
    {
    // only process on real-time data
    if (State == State.Historical)
    return;

    else if (State >= State.Realtime)
    // rest of logic
    }

    Shouldn't this say ... in the OnBarUpdate() method...?

    BTW, awesome new capability - this is something I spent months finding work arounds for.
    Confusing I agree, until I thought of it this way. The State enum is a different and independent entity from the event handler/method OnStateChange(). We can query the State from anywhere that it is in scope, which pretty much means for all user classes, as the enum is declared way back in the NinjaScript namespace.

    Leave a comment:


  • molecool
    replied
    Originally posted by sledge View Post
    I at first read it that way that you are thinking - but if you look up OnStateChange - it makes more sense.

    Historical was tucked away into OnStateChange(), realtime was added.

    OnStateChange I suspect will be called first when historical hits, when realtime hits, etc.. You are just checking the state in OnBarUpdate that was caused by OnSTateChange.
    The context is what doesn't make sense to me, sorry. By the time OnStateChange() catches it the State object has already been changed. The action happens in the OnBarUpdate() method where you are actually making use of it as in the example. It's not that you *have to* override OnStateChange to make use of that State object.

    Call me a stickler but IMHO that part of the doc should be rewritten a little to make that more clear.

    Leave a comment:


  • sledge
    replied
    I at first read it that way that you are thinking - but if you look up OnStateChange - it makes more sense.

    Historical was tucked away into OnStateChange(), realtime was added.

    OnStateChange I suspect will be called first when historical hits, when realtime hits, etc.. You are just checking the state in OnBarUpdate that was caused by OnSTateChange.

    Leave a comment:


  • molecool
    started a topic Correction in the Code Breaking Changes Overview

    Correction in the Code Breaking Changes Overview

    A small oversight apparently in the documentation:

    NinjaTrader previously used a Historical bool property to notify when an indicator or strategy bar was being processed historically or real-time. The NinjaTrader 8 OnStateChange() method has now introduced a concept of State.Historical or State.Realtime which will allow you to take action depending on the desired state:

    protected override void OnBarUpdate()
    {
    // only process on real-time data
    if (State == State.Historical)
    return;

    else if (State >= State.Realtime)
    // rest of logic
    }

    Shouldn't this say ... in the OnBarUpdate() method...?

    BTW, awesome new capability - this is something I spent months finding work arounds for.

Latest Posts

Collapse

Topics Statistics Last Post
Started by chbruno, Today, 04:10 PM
0 responses
3 views
0 likes
Last Post chbruno
by chbruno
 
Started by josh18955, 03-25-2023, 11:16 AM
6 responses
436 views
0 likes
Last Post Delerium  
Started by FAQtrader, Today, 03:35 PM
0 responses
6 views
0 likes
Last Post FAQtrader  
Started by rocketman7, Today, 09:41 AM
5 responses
19 views
0 likes
Last Post NinjaTrader_Jesse  
Started by frslvr, 04-11-2024, 07:26 AM
9 responses
127 views
1 like
Last Post caryc123  
Working...
X