Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Method interrupt

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

    Method interrupt

    If OnBarUpdate() calls a method and that method subsequently calls a 3rd method, will OnBarUpdate() interrupt/preempt the completion of either of those methods on any new tick?, Or if a new tick comes in that will trigger a call to the first method, such as setting a new bar high or low.

    OnBarUpdate() calls NewHighLow() if a tick creates a new or equals the old bar High or Low. NewHighLow() performs the calculations and calls DrawPatterns() as the last statement. I have been having problems with patterns not being displayed or removed when no longer valid. Hitting F5, however, makes everything look as it should.

    Snap

    #2
    No "interruption" occurs. When you are in your strategy's OnBarUpdate() it takes whatever is the latest processed tick from your indicator. This may be the same tick the strategy is processing now or it can even be the previous tick. There is no guarantee of the order because of the multi-threaded nature of these processes.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      That's what I thought, si I guess I'll have to dig a little deeper.

      Comment


        #4
        On rereading your message, I noticed you said, "When you are in your strategy's OnBarUpdate() it takes whatever is the latest processed tick from your indicator."

        This situation occurs in the indicator, not the strategy. Does that make any difference?

        Comment


          #5
          Hi snaphook,

          I am not 100% sure if it makes a difference, will check...

          But you try forcing an update of your embedded indicator calculations -

          Comment


            #6
            Any further thoughts on this subject. The problem cropped up again this morning during a furious gold rush. That is typically when the problem occurs, during fast markets making new bar highs and lows. The patterns appear and disappear (drawn and removed depending on validity of the signal) but on the next bar a refresh brings them out right where they should have been.

            Comment


              #7
              snaphook,

              Let us clarify, what is the exact scenario you have?

              Strategy calling indicator? Calculation in indicator? Calculation in the strategy? Please be as specific as possible in outlining what you seeing and I will let you know if that is expected or not. Thank you.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                First, let me say that you all are the best at customer service.

                Precisely this deals with Woodies CCI and is in the pattern recognition indicator with no strategy involved. OnBarUpdate() simply looks for bar highs and lows. When a new high/low is made, or an existing one is met, a call is made to void NewHighLow() which performs the analysis/calculations and sets variables instantiated in the variables region to identify the pattern that has been detected. At the completion of this method control is returned to OnBarUpdate() which calls DrawPatterns() which checks the variables set in NewHighLow() and draws objects in the panel or removes them, depending on if a pattern was found or an old one is no longer valid.

                If no high/low is reached, OnBarUpdate() calls DrawPatterns() w/o calling NewHighLow(). I doubt this is absolutely required, but it is there because of this problem.

                The problem is that in fast markets, the patterns are drawn and removed by DrawPatterns() with rapidly changing prices and sometimes they will not be redrawn on a new high/low. Because this occurs in fast markets it is hard for me to see what is happening.

                I used to have the whole thing in OnBarUpdate() and did not have this problem, but cpu load was very high.

                I hope this gives you enough info. Thanks for any help you can provide,
                Snap

                Comment


                  #9
                  So you are doing this?
                  1. OnBarUpdate -> method1
                  2. method1 does calculations
                  3. method1 ->OnBarUpdate
                  4. OnBarUpdate -> method2

                  Otherwise
                  1. OnBarUpdate -> method2

                  Issue is you feel OnBarUpdate is going to method2 preemptively in the first scenario?

                  Unfortunately the only way to figure out what is happening here is to debug. Use print logs and slowly track out its behavior.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  571 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  331 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  549 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  550 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X