Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnStartUp

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

    OnStartUp

    Hi,

    I have a class level int where I store a calculation that is done in OnStartUp.

    When I try to use the variable in OnBarUpdate it has reverted to zero. I put the identical print statement in both OnBarUpdate and OnStartUp and get two different values. The only place the variable is set is in OnStartUp.

    Any ideas what I am doing wrong?

    Best Regards,
    Scott

    From the print statements
    OnStartUp

    Bars count 2548
    last bar in sample 2038

    OnBarUpdate

    Current bar 20 3/27/2011 7:45:00 PM
    last bar in sample 0

    #2
    Hello,

    Thanks for the forum post.

    Would need you to send code into support at ninjatrader dot com referencing this thread. Since I'm not sure where the coding error is and would just be a shot in the dark. Dont even have anything reallt o suggest other then adding in more prints to find out where exactly it gets changed.

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Brett,

      I have coded C# and NinjaTrader for quite a while. If there aren't any known issues that could cause a variable set in OnBarStartUp to be reset elsewhere; then I will take it from here.

      I just don't want to be chasing my tail debugging my code only to find out it is a known issue or one other clients are having.

      Best Regards,
      Scott

      Comment


        #4
        Hello,

        Understood. I see no reason why this would occur just based off the info you have given me. Also no known open cases currently.
        BrettNinjaTrader Product Management

        Comment


          #5
          Brett, thanks; that is what I needed to know. If I get stuck, I will send you the code but hopefully, I will figure it out on my own.

          Comment

          Latest Posts

          Collapse

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