Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate() method not executing

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

    OnBarUpdate() method not executing

    Hi,

    I have a strategy that creates a popup Button Trader type of window. It has been working perfectly, but suddenly the OnBarUpdate() method has stopped executing (tested with a Print() statement). The popup appears as usual, and there are no error messages.

    I have just installed the latest version of NT7, hoping that would fix it, but the problem remains.

    Strangely, when I deleted the strategy and then recreated it, it worked fine until I exited NT and then restarted. Then the same problem reappeared.

    Is it possible something is corrupted? And if so, should I try a complete reinstall (deleting the NT7 folder etc)? Or is there something else I should try first?

    Thanks

    #2
    palinuro, do you see any log tab errors as this occurs? Working with custom buttons would be unfortunately outside of the scope we can support here, to simplify finding the cause I would remove the custom script and test with a simple script just printing in OnBarUpdate() and seeing if this works normally then (ensure the session template applied covers the needed time range).

    Comment


      #3
      Yes, I know you don't support that, but I thought you might have an idea what could stop OnBarUpdate() from triggering - and only after I've restarted NT.

      There are no log errors, and the buttons themselves work fine for submitting orders etc. And all the other methods, including OnOrderUpDate(), OnExecution() and OnTermination() also work fine. It's just that OnBarUpdate() isn't called.

      Comment


        #4
        palinuro, most of the time I saw this issue it was BarsRequired / lastDate / SessionTemplate related, so there was actually no data coming to the chart / strategy calling OnBarUpdate(). Is the same phenomenon happening for you in a simple standard strategy or indicator? Is the chart then normally updating still, but you would not see programmatic OBU() calls?

        Thanks,

        Comment


          #5
          Hi Bertrand,
          thanks for your response and suggestion. The charts were updating normally, but this was running from the Strategy tab, and I didn't think of putting it on the chart. However, I hadn't changed anything connected to the Session Template, bars required, etc.

          I have resolved the problem, though I don't know the cause.

          I asked about the possibility of a corruption because I had such problems with NT 6.5 a number of times. When I had recompiled an indicator a large number of times, NT would become 'stuck' on an earlier compiled version, even though the new code was different. The only solution was to start from scratch, and with a different indicator name.

          I haven't had that happen in over a year of using NT7, but I had recompiled this strategy a number of times while changing the popup format, so I decided to try something similar:

          1. Copy and delete the Strategy folder.
          2. Reinstall NT7
          3. Open the old strategy in VS, then copy and paste the code into a new strategy in NT.
          4. Compile and run.

          It now works perfectly - but the code and all other settings are exactly the same as before.

          Comment


            #6
            palinuro,

            Glad you got this working. Unfortunately I cannot comment on any popups you may be utilizing in your code as that is well beyond the scope we can provide support for. What I can say is that there have been no reports of any such "corruption" when compiling NinjaScript from other users though.
            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
            669 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            378 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            111 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