Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT 8 Bug or Feature? Zombie Indicator

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

    NT 8 Bug or Feature? Zombie Indicator

    I was trying to understand the onStateChange() method, so I created the simplest of NijaScripts that I called ShowState (attached). I generated the New Indicator from the Editor and added the line below to OnStateChange(). Changed nothing else.

    protected override void OnStateChange()
    {
    Print ("ShowState: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " State Change = " + State);
    if (State == State.SetDefaults)
    . . .
    }
    1) Opened NinjaScript Output Window and Added my ShowState Indicator to Chart.
    2) Immediately saw messages from ShowState in Output Window.
    3) After playing with various activities to watch the State Change I removed the Indicator from the Chart.
    4) To my amazement the ShowState messages continued to be written to the Output Window.
    5) Added ShowState back into the Chart and now the messages were doubled.
    6) Removed ShowState from Chart and single messages still written to Output Window.

    7) Created new Workspace named Zombie Demo
    8) Saved and copied workspace when new, after Indicator added, and after all Indicators removed.
    9) Restarted NT and still getting ShowState messages.
    10) Only way to kill the zombie was to set ShowState as Excluded From Compilation and Compile.

    Attached as Zombie message.jpg was created by:

    1) Open NT
    2) Open Output Window and Clear it.
    3) Select Indicators...
    4) Take snapshot of Indicators and Output Window.
    Attached Files
    Last edited by Jim W.; 10-21-2015, 02:25 PM.

    #2
    Which States were you seeing printed after you removed it? In my testing, it only shows State.SetDefaults and State.Terminated.

    Similar to the Initialize() method, OnStateChange() will be called for these two States mentioned above throughout the lifetime of the applications run time, even if it is not configured on a chart. This is expected behavior.

    The reason for this is the same as in NinjaTrader 7, when you open your indicators menu, there is a call to each of the indicators SetDefaults in order to generate the list of indicators you see displayed on the UI.

    In NinjaTrader 8 this process will now call State.Terminated as well.

    You should not see anything beyond these two states when the indicator is not actually running. But do let us know if you see otherwise and we'll be happy to look into.
    MatthewNinjaTrader Product Management

    Comment


      #3
      2 pages here.

      I had another thread I can't find right now.


      Comment


        #4
        Originally posted by NinjaTrader_Matthew View Post
        Which States were you seeing printed after you removed it? In my testing, it only shows State.SetDefaults and State.Terminated.
        After Removed, I only remember seeing State.SetDefaults and State.Terminated.

        Please expand more on what you mean by "indicator is not actually running":

        Doesn't removing an Indicator from a Chart mean that it should not do anything on that Chart from then on?

        Are you saying that OnStateChange() is entered for all Indicators Compiled, not just the ones Added the Chart?

        Or, once Added OnStateChange() will always be called even after removed?

        Comment


          #5
          You are correct that OnStatechange() is entered for all indicators which are compiled on the system. They do not have to be "Configured" on a chart (i.e., running).

          This would happen even if the indicator was never added and configured to a chart.
          MatthewNinjaTrader Product Management

          Comment


            #6
            This was the one I wanted to find.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            39 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Today, 08:51 AM
            2 responses
            15 views
            0 likes
            Last Post bill2023  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            167 responses
            2,260 views
            0 likes
            Last Post jeronymite  
            Started by warreng86, 11-10-2020, 02:04 PM
            7 responses
            1,362 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Working...
            X