Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 V05 - State.Terminated event firing after connect

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

    NT8 V05 - State.Terminated event firing after connect

    I have an odd issue at one of my customers.

    We attach an indicator to a chart, it runs fine and then we close Ninja, saving the workspace on the way out.

    Then on startup, the indicators and associated DLLs are starting up correctly.

    1 - NT8 Starts up fine
    2 - Chart Windows open ok
    3 - Indicators/associated DLLs open & execute ok

    All good so far, everything looks good & we are just waiting for the connection.

    What then happens is that when we finish connecting, we get a State.Realtime event followed immediately by a State.Terminated event.

    At that point, my code is closing everything down because it presumes the Terminated state is triggered when the indicator is being removed.

    After that Terminated event, there are no other state events, it does not restart.

    Nothing will happen unless I click F5 on the chart, in which case it'll start up my indicator & associated DLLs just fine.

    The funny thing is - this works fine for most people. It's just going on with one customer on Windows 10.

    Any ideas?

    Pete

    #2
    Hello,

    Thank you for the report.

    I will test this to see if I can re produce this and provide any details I may find in the process.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,

      I wanted to gather more details on this as I have been unable to recreate using these steps.

      Can you tell me, does this only happen with using the DLL you have spoke of or does this also happen using only system indicators?

      If this does also happen with system indicators, could you provide a workspace that has a chart and indicator saved that demonstrates this? You would find the workspace file in the folder: Documents\NinjaTrader 8\workspaces

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Hello,
        I've noticed a similar issue. When I will add a code with State.Terminated to any strategy and I will open Strategies window on a chart (Ctrl + S), on Output I will get a test printout. When I close Strategies window (even cancel it), I will get another printout.
        Code:
        else if (State == State.Terminated)
        {
        Print("test");
        }
        This shouldn't happen, because I didn't even open any strategy and this code should only be executed, when strategy is being closed.

        Comment


          #5
          Originally posted by InteRadek View Post
          Hello,
          I've noticed a similar issue. When I will add a code with State.Terminated to any strategy and I will open Strategies window on a chart (Ctrl + S), on Output I will get a test printout. When I close Strategies window (even cancel it), I will get another printout.
          Code:
          else if (State == State.Terminated)
          {
          Print("test");
          }
          This shouldn't happen, because I didn't even open any strategy and this code should only be executed, when strategy is being closed.
          State.SetDefaults and State.Terminated are called when you open the strategy or indicator dialog, this is used to populate the list of objects that are installed on the system.

          If that is causing problems for you, you can create a flag in a State >= State.Configure which will indicate that the strategy/indicator has actually been loaded, and then only execute logic in State.Terminated when that flag is true.
          MatthewNinjaTrader Product Management

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello,

            I wanted to gather more details on this as I have been unable to recreate using these steps.

            Can you tell me, does this only happen with using the DLL you have spoke of or does this also happen using only system indicators?

            If this does also happen with system indicators, could you provide a workspace that has a chart and indicator saved that demonstrates this? You would find the workspace file in the folder: Documents\NinjaTrader 8\workspaces

            I look forward to being of further assistance.
            Here is a video showing the issue: https://youtu.be/kPDQaQ1VV9w

            As you can see I open up Ninja, the chart opens and so does the output window. I then connect and after the connection is made, I get a terminated message.

            I have uploaded the indicator and a zip file containing the workspace.

            Cheers

            Pete
            Attached Files

            Comment


              #7
              Hi,
              placing a flag in a State.Configure didn't do the trick, because it is activated once I open a Strategy dialog window. Till I run a strategy, it is initiated several times. But placing the flag in State.DataLoaded works as expected.
              Code:
              private bool isActive = false;
              if (State == State.SetDefaults)
              {
                  ...
              }
              else if (State == State.DataLoaded)
              {
                  isActive = true;
                  Print("Enabled");
              }
              else if (State == State.Terminated && isActive)
              {
                  Print("Disabled");
                  isActive = false;
              }

              Comment


                #8
                Hello,

                Originally posted by DionysusToast View Post
                As you can see I open up Ninja, the chart opens and so does the output window. I then connect and after the connection is made, I get a terminated message.

                I was able to see this on my end and I am currently working with Development on this. When I have further information I will post it here.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  I just wanted to post some clarification on the original question here.

                  Based on what is happening in the script, the Termination event on connect would be expected. The next state print would only happen after the data has been loaded and displayed going into realtime.

                  The connect event will cause the chart to Reload which would cause the Terminated state.

                  The solutions would be as outlined in the posts in this thread by using a bool.

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Jesse View Post
                    Hello,

                    I just wanted to post some clarification on the original question here.

                    Based on what is happening in the script, the Termination event on connect would be expected. The next state print would only happen after the data has been loaded and displayed going into realtime.

                    The connect event will cause the chart to Reload which would cause the Terminated state.

                    The solutions would be as outlined in the posts in this thread by using a bool.

                    Please let me know if I may be of further assistance.
                    Here is a video. When I connect to the first connection (IQFeed) - it all appears to work OK.

                    The problem is when I connect to a second feed. At that time, it triggers the "Terminated" state and no other states.

                    Please take a look at the attached video - as you can see there is no "going into realtime" afterwards.

                    Comment


                      #11
                      Hello,

                      Thank you for posting this video.

                      I am currently working with development on this to determine the correct order of events that should happen vs what is happening in the video.

                      Once I have further details I will update this thread.

                      I look forward to being of further assistance.
                      JesseNinjaTrader Customer Service

                      Comment


                        #12
                        Any news on this one?

                        Comment


                          #13
                          Hello,

                          Thank you for the reply.

                          I do show this as being fixed in B7 per the note in the change log:

                          NTEIGHT-9016 OnBarUpdate() was no longer called after connecting to a second data provider

                          Could you confirm if you are still able to reproduce this in a fresh install of the B7?

                          I look forward to being of further assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            Sorry it took so long to get back to you!

                            I can confirm this is fixed in the B7 release - many thanks.

                            Peter

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by kujista, Today, 05:44 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post kujista
                            by kujista
                             
                            Started by ZenCortexCLICK, Today, 04:58 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post ZenCortexCLICK  
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            172 responses
                            2,281 views
                            0 likes
                            Last Post sidlercom80  
                            Started by Irukandji, Yesterday, 02:53 AM
                            2 responses
                            18 views
                            0 likes
                            Last Post Irukandji  
                            Started by adeelshahzad, Today, 03:54 AM
                            0 responses
                            8 views
                            0 likes
                            Last Post adeelshahzad  
                            Working...
                            X