Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator, resumption from suspension

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

    Indicator, resumption from suspension

    Hi,

    I have a few indicators I have added sound / voice announcements too. This is all great and works fine. For the most part, I leave IsSuspendedWhileInactive = true, except in special cases where I need it off for specific reason, to preserve resources. One issue I have, is that when the tab is re-selected and the indicator catches up, I can get a batch of announcements.

    So, my question is, is there a way to tell if the indicator is not realtime, and is in catch up mode, so I can skip them? I'd normally use State = State.Realtime, but I and not sure it works in these cases?

    Thanks.

    #2
    Hello pjsmith,

    Thank you for your post.

    Would you be able to provide a basic version of your script for us to test and ensure that you're seeing expected behavior (though it sounds likely that you are)? We may be able to better ascertain a potential resolution. You may remove any code unnecessary to reproduce.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi - Well, I can reduce it to something _really_ simple. Assume Suspendwhileinactive = true and indicator is run onBarUpdate

      Code:
      OnBarUpdate()
      {
               DoSomthing();  // how do you ensure this does not run when the indicator catches up, after it has been suspended?
      }
      Does that make sense?

      Comment


        #4
        Hello pjsmith,

        Thank you for your reply.

        We've found a resolution for this.

        If you check:

        Code:
        if (CurrentBar == Bars.Count - 2)
        {
             //alerts go in here
        }
        This only occurs when the indicator is actively processing. If CurrentBar doesn't equal Bars.Count - 2, the indicator is playing catch-up.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Much appreciated. I will test over weekend. Happy Friday

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gm7_forum, Today, 05:51 PM
          0 responses
          2 views
          0 likes
          Last Post gm7_forum  
          Started by cre8able, Today, 03:20 PM
          1 response
          9 views
          0 likes
          Last Post cre8able  
          Started by fiddich, Today, 05:25 PM
          0 responses
          3 views
          0 likes
          Last Post fiddich
          by fiddich
           
          Started by gemify, 11-11-2022, 11:52 AM
          6 responses
          804 views
          2 likes
          Last Post ultls
          by ultls
           
          Started by ScottWalsh, Today, 04:52 PM
          0 responses
          4 views
          0 likes
          Last Post ScottWalsh  
          Working...
          X