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!
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
NinjaTrader
Debugging questions
Collapse
This topic is closed.
X
X
-
-
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
-
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
-
Seems to be just a convenient desgn decision
Originally posted by ETFVoyageur View PostAfter 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
-
Originally posted by NinjaTrader_Dierk View PostPlease use OnTermination and not Dispose() as stated in the docs to avoid any further confusion. Thanks
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
-
Originally posted by koganam View PostI 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()
That kind of makes sense. My reservation is that they do not reliably call OnTermination(), though.
--EV
Comment
-
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
-
Originally posted by NinjaTrader_Dierk View PostUnfortunately 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.
- 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
-
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
-
Originally posted by ETFVoyageur View PostNinjaTrader_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 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
-
Usage details tell only a little of the story
Originally posted by ETFVoyageur View PostNinjaTrader_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.
Comment
-
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
-
Originally posted by NinjaTrader_Dierk View PostUnfortunately your understanding of the internal operations of the NT framework is incomplete.
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 ageeholdings, 05-01-2024, 05:22 AM
|
6 responses
42 views
0 likes
|
Last Post
by ageeholdings
Today, 08:37 PM
|
||
Started by tony_28217, Today, 07:04 PM
|
0 responses
11 views
0 likes
|
Last Post
by tony_28217
Today, 07:04 PM
|
||
Started by flybuzz, Today, 10:33 AM
|
1 response
9 views
0 likes
|
Last Post
by flybuzz
Today, 06:59 PM
|
||
Started by spencerp92, 10-10-2023, 09:56 AM
|
4 responses
309 views
0 likes
|
Last Post
by flybuzz
Today, 06:45 PM
|
||
Started by samish18, Yesterday, 10:13 AM
|
1 response
26 views
0 likes
|
Last Post Today, 06:15 PM |
Comment