• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ninjascript way to identify if in OnTermination event

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

    Ninjascript way to identify if in OnTermination event

    Hi,

    I'm overloading OnTermination with some code to clean up and log stuff in my indicator and I have hit a problem.

    When I am running my indicator and I re-load the ninjascript from the right-click menu, the OnTermination event triggers at some point as a consequence. I do some stuff with the multiple bars and the CurrentBar number etc.

    I just found that re-loading the historical data calls the OnTermination event but at a different point, a point at which something in the BarsArray had been cleaned up by Ninja already and it caused my OnTermination code to break.

    Can you tell me what one single variable or state can I check in my OnTermination event to determine whether Ninja is stopping the indicator script?

    e.g. is there something useful like Indicator.ScriptTerminatingNow

    #2
    OnTermination itself would be what would be called when the indicator is stopping. This would happen after manually disabling the indicator, reloading the NinjaScript or after reloading historical data. I'm not aware of a way to check for this outside of the event itself.

    If this is causing problems for you, you may want to consider creating your own Dispose methods and calling them in your own custom event trigger method:

    http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx

    http://www.ninjatrader.com/support/h...ustomevent.htm
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by harjinderjit, Today, 08:24 PM
    0 responses
    18 views
    0 likes
    Last Post harjinderjit  
    Started by Againmain1, Today, 03:04 AM
    1 response
    24 views
    1 like
    Last Post NinjaTrader_ShawnB  
    Started by jmahon, Yesterday, 11:44 PM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by Tomhgriff1, 01-03-2020, 04:07 AM
    4 responses
    50 views
    0 likes
    Last Post bkonia
    by bkonia
     
    Started by cary1267, Today, 09:37 AM
    1 response
    25 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Working...
    X