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

Debugging questions

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Very nice. And a great many thanks. That goes straight into my template system.

    Comment


      #17
      Originally posted by koganam View Post
      Very nice. And a great many thanks. That goes straight into my template system.
      You are welcome. It is part of a demo indicator that I maintain so I can use it as a base for any new indicators I create.

      --EV

      Comment


        #18
        Some architectural notes

        NinjaTrader_Dierk: I removed your post since it contained information which is misleading and in parts even incorrect. This may lead the followers of this thread to wrong conclusions and cause more confusion than clarification.

        I believe we correctly outlined the usage model of Initialize(), OnStartup() and OnTermination() in our docs. If you feel there would be bugs in said docs then please let us know so they could be addressed.

        Thanks for your understanding.
        Last edited by ETFVoyageur; 01-18-2011, 01:40 PM.

        Comment


          #19
          After all of this, I still have one unanswered question::
          What is the role of OnTermination()
          All I have seen or heard is that NT says you should put the cleanup you would normally put in Dispose() in OnTermination() instead.

          So why invent OnTermination()? Why didn't the code that calls OnTermination() just call Dispose() instead of inventing a new method?

          Is there some intended purpose for OnTermination(), other than cleanup?

          --EV

          Comment


            #20
            Please use OnTermination and not Dispose() as stated in the docs to avoid any further confusion. Thanks

            Comment


              #21
              Seems to be just a convenient desgn decision

              Originally posted by ETFVoyageur View Post
              After all of this, I still have one unanswered question::
              What is the role of OnTermination()
              All I have seen or heard is that NT says you should put the cleanup you would normally put in Dispose() in OnTermination() instead.

              So why invent OnTermination()? Why didn't the code that calls OnTermination() just call Dispose() instead of inventing a new method?

              Is there some intended purpose for OnTermination(), other than cleanup?

              --EV
              I believe that may just have been a design decision to avoid having to overload the Dispose() method. Direct disposition without having to remember to call base.Dispose()

              Comment


                #22
                Originally posted by NinjaTrader_Dierk View Post
                Please use OnTermination and not Dispose() as stated in the docs to avoid any further confusion. Thanks
                Let's not rehash this thread again.

                My question is what purpose OnTermination() has, other than cleanup. Surely if its only purpose was to do cleanup, you could have just called Dispose() and avoided creating a new method.

                So what, other than cleanup, should I be doing in OnTermination()?

                --EV

                Comment


                  #23
                  Originally posted by koganam View Post
                  I believe that may just have been a design decision to avoid having to overload the Dispose() method. Direct disposition without having to remember to call base.Dispose()
                  Interesting theory. To take on the role of ensuring that the base Dispose() gets called, so that custom indicator code does not mess that up.

                  That kind of makes sense. My reservation is that they do not reliably call OnTermination(), though.

                  --EV

                  Comment


                    #24
                    Unfortunately your understanding of the internal operations of the NT framework is incomplete. To not confuse matters I recommend sticking to the documentation.

                    For your convenience I copied again the relevant parts below. In case it's not clear: OnStartup would be called before any of the On... NinjaScript events. OnTermination would be called on any instance where OnStartup was called. Neither one would be called on instances which are created for NT internal operations only.

                    You can override the OnStartUp() method to initialize any variables or resources you wish to use in the custom indicator or strategy. This method is called only once immediately prior to the start of your script, but after the Initialize() method.



                    For advanced programmers: You can override the OnTermination() method to clean up all resources owned by the custom indicator or strategy.

                    Note: Please do NOT overload the Dispose() method. Dispose() method could be triggered much later than expected resulting in resources not being released early enough.

                    Comment


                      #25
                      Originally posted by NinjaTrader_Dierk View Post
                      Unfortunately your understanding of the internal operations of the NT framework is incomplete. To not confuse matters I recommend sticking to the documentation.

                      For your convenience I copied again the relevant parts below. In case it's not clear: OnStartup would be called before any of the On... NinjaScript events. OnTermination would be called on any instance where OnStartup was called. Neither one would be called on instances which are created for NT internal operations only.

                      You can override the OnStartUp() method to initialize any variables or resources you wish to use in the custom indicator or strategy. This method is called only once immediately prior to the start of your script, but after the Initialize() method.



                      For advanced programmers: You can override the OnTermination() method to clean up all resources owned by the custom indicator or strategy.

                      Note: Please do NOT overload the Dispose() method. Dispose() method could be triggered much later than expected resulting in resources not being released early enough.
                      So let me see if I can translate this into what I understand.
                      • OnTermination() is called if, and only if, OnStartup() was called.
                      • Use OnTermination() to clean up any objects created in OnStartUp()

                      Is that substantially what you are saying here?

                      Comment


                        #26
                        Thanks. I'm aware of that material.

                        Since no one has ever explained why OnTermination() even exists, I was wondering whether or not there was anything other than cleanup that it is to be used for?

                        Since you do not mention anything, nor do any of the items you cite, I conclude that the only use for OnTermination() is cleanup.

                        Why it even exists will continue to be a mystery. Perhaps kogonam's speculation is correct -- it is to minimize the likelihood of developers forgetting to call base.Dispose() and leaking resources that way.

                        --EV

                        Comment


                          #27
                          Originally posted by ETFVoyageur View Post
                          NinjaTrader_Dierk: I removed your post since it contained information which is misleading and in parts even incorrect. This may lead the followers of this thread to wrong conclusions and cause more confusion than clarification.

                          I believe we correctly outlined the usage model of Initialize(), OnStartup() and OnTermination() in our docs. If you feel there would be bugs in said docs then please let us know so they could be addressed.

                          Thanks for your understanding.
                          I am sorry you did that.

                          I have already made the suggestion that your docs are good at details, but do nothing to show the big picture. There is no architectural document anywhere that I know of.

                          I would be much happier if you had told me/us what was wrong with my description. Could you please let me know, so that I can gain a better understanding?

                          --EV

                          Comment


                            #28
                            Usage details tell only a little of the story

                            Originally posted by ETFVoyageur View Post
                            NinjaTrader_Dierk: I removed your post since it contained information which is misleading and in parts even incorrect. This may lead the followers of this thread to wrong conclusions and cause more confusion than clarification.

                            I believe we correctly outlined the usage model of Initialize(), OnStartup() and OnTermination() in our docs. If you feel there would be bugs in said docs then please let us know so they could be addressed.

                            Thanks for your understanding.
                            Yes, the usage details are somewhat clearly explained: how they tie together is not. It might be more useful, if we understand the structure/process flow involved in an indicator. Usage details alone do not tell that story.

                            Comment


                              #29
                              Dierk,

                              I cannot find how to PM you.

                              I am going to cool off before I post publicly what I would PM if I could.

                              --EV

                              Comment


                                #30
                                Originally posted by NinjaTrader_Dierk View Post
                                Unfortunately your understanding of the internal operations of the NT framework is incomplete.
                                I'm sure it is.

                                Evidently you feel this is why I do not understand the life cycle of an indicator object, so please enlighten me.

                                I feel as if I am trying hard to understand the system and you are telling me I have no need to understand it.

                                --EV

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by arvidvanstaey, Today, 02:19 PM
                                4 responses
                                11 views
                                0 likes
                                Last Post arvidvanstaey  
                                Started by samish18, 04-17-2024, 08:57 AM
                                16 responses
                                61 views
                                0 likes
                                Last Post samish18  
                                Started by jordanq2, Today, 03:10 PM
                                2 responses
                                9 views
                                0 likes
                                Last Post jordanq2  
                                Started by traderqz, Today, 12:06 AM
                                10 responses
                                18 views
                                0 likes
                                Last Post traderqz  
                                Started by algospoke, 04-17-2024, 06:40 PM
                                5 responses
                                48 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Working...
                                X