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.


      http://ninjatrader.com/support/forum...eChange&page=2

      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.

            http://ninjatrader.com/support/forum...=OnStateChange

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Gaterz, Yesterday, 06:52 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Marco  
            Started by dmelleady, Yesterday, 10:18 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChrisSch  
            Started by arangocj, Yesterday, 09:46 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by rgoudie, Yesterday, 09:13 PM
            2 responses
            9 views
            0 likes
            Last Post rgoudie
            by rgoudie
             
            Started by bosajin, Yesterday, 03:48 PM
            3 responses
            12 views
            0 likes
            Last Post bosajin
            by bosajin
             
            Working...
            X