• 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 ct, Today, 05:31 AM
    0 responses
    1 view
    0 likes
    Last Post ct
    by ct
     
    Started by pstrusi, Today, 02:21 AM
    0 responses
    5 views
    0 likes
    Last Post pstrusi
    by pstrusi
     
    Started by indy73, Yesterday, 10:52 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_EricB  
    Started by priceisking, 05-13-2019, 08:30 AM
    6 responses
    40 views
    0 likes
    Last Post Harry
    by Harry
     
    Working...
    X