Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnStartUp vs Initialize

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

    OnStartUp vs Initialize

    I understand that OnStartUp gets called once only and after initialize.
    So is it ok to do this ie place eventhandler stuff here?


    Code:
    protected override void OnStartUp()
    {
    chartpanel = ChartControl.ChartPanel;
    [COLOR="Red"]chartpanel.KeyDown += new KeyEventHandler(this.OnKeyDown);[/COLOR]	
    }

    #2
    Mindset, you would need to give it a try - correct OnStartUp() is the best place for allocating custom resources to be used as it does not get called multiple times like script's Initialize().

    Comment


      #3
      Works

      Oh yes it definitely works but my programming skills are kindergarten and I was simply wondering if it is better in OnStartUp rather than Initialize - precisely because as you say it only gets called just once.
      ie is it elegant and efficient programming?

      Comment


        #4
        Moving those parts to OnStartUp() is good programming yes, it was exactly created for allocating custom resources, as in 65 you had to do it all on first OnBarUpdate() bar to avoid multiple calls.

        Comment


          #5
          thanks

          Many thanks Bertrand

          Comment


            #6
            Question about the help docs for NT7.0.0.16 in regard to the "Initialize vs. OnStartUp" discussion. The help docs advocate calling any license checks from within OnStartUp...however, if you put the VendorLicense call in OnStartUp, then you never get a a popup window when the license fails validation. If you put the VendorLicense call in Initialize(), you will get a popup window when the license fails validation.

            So I believe either the docs should contain information on this important side-effect, or the popup window should be triggered from within the OnStartUp() method.

            Comment


              #7
              Ben, I had to reread that area and it seems the standard NinjaTrader Vendor license check should be in the Initialize() section but if you are using your own custom check it should go in OnStartUp().

              Dan
              eDanny
              NinjaTrader Ecosystem Vendor - Integrity Traders

              Comment


                #8
                That's sounds reasonable...so then it's really just a matter of rephrasing/clearing up the statement in the help docs under "Initialize()".

                Comment


                  #9
                  Ben, I'll forward this to be expressed more clear as far as the differences go for license checks used.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  595 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  343 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  556 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  554 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X