• 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 XimoTrader, Today, 12:57 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by FxInception, Today, 12:27 PM
    2 responses
    10 views
    0 likes
    Last Post FxInception  
    Started by siroya, Today, 10:34 AM
    1 response
    20 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Leeroy_Jenkins, Today, 11:22 AM
    2 responses
    12 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by RedDuke, Today, 10:27 AM
    2 responses
    15 views
    0 likes
    Last Post RedDuke
    by RedDuke
     
    Working...
    X