Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Buttons dissappear when editing "Data series"

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

    Buttons dissappear when editing "Data series"

    Hi,

    I have added buttons to the chart using the same method as the attached example which was provided by SIM22 in one of the NT8 beta threads which is now locked (See attached)

    When opening the data series properties on the chart the buttons disappear from the chart until F5 is pressed again.

    Even clicking and holding on the candles then dragging and letting go will cause the buttons to disappear...

    Any ideas why?
    Attached Files

    #2
    Thank you for your question, marty087. while directly debugging user code is beyond the scope of the support we may provide, upon examining your code it appears the code to create your buttons occurs during the Historical state, and the variable installDP is not being reset for this reason. The attached script will simply send the name of each state to the output window, as well as the state of a private variable which is flipped once during State.Historical via a dispatcher. This script should make it easier to design a solution which will work for the script you sent us. As you can see from the sample output, as soon as I load a data series or indicator window again, this resets the boolean variable, and runs us through the states again. I would recommend experimenting with moving the dispatcher code to other states and locking variables. If you are able to get the "toggle" variable to remain false in the script I attached, then you will be able to get your buttons to remain on a chart. The documentation on states will be invaluable to the development process. Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi Jessica,

      Thank you for the reply. I have removed the boolean conndition from DP installation all together and still the issue persists.

      When rght clicking on the data series of a chart and selecting "Properties" then clicing "OK" OnStateChange() is not called. Because of this, surely any code that I do or do not have in any state changes is irrelevant, isnt it?

      Using the code below it is clear that the above is true. My question, what changes are occuring during inspecting / changing the data series properties is causing the DP to disappear?

      protected override void OnStateChange()
      {

      Print("There is a state change");
      }

      Thank you.

      Comment


        #4
        I have modified the code sample so that it is similar to the vcode you posted, as follows :

        Code:
                    //if (State >= State.SetDefaults)
                    //{
                        Print("State: " + State);
                        Print("toggle: " + toggle);
                    //}
        That is, like your code, this will print ever time OnStateChange is called. It did this previously, since State.SetDefaults is the first state, but this way we can be sure we are looking at the exact same thing.

        Since our code is now equivalent, using either my code or your own, please change the Data Series that is being fed into the indicator, then finalize this change by pressing "OK" on the Data Series window, then notice that new messages have shown up after this has happened.

        On my system, this output appears when I do this. I have cleared all output except output that shows after pressing OK from the data series screen.

        State: SetDefaults
        toggle: True
        State: Terminated
        toggle: False
        State: Configure
        toggle: True
        State: DataLoaded
        toggle: True
        State: Historical
        toggle: True
        State: Transition
        toggle: False
        State: Realtime
        toggle: False
        If you are pressing Cancel and not OK to leave the data series window, please let us know, so we can assist further. I have modified the script to run on 5 second bars and to print out toggle's state on bar close so that we can investigate further should this be the case.
        Attached Files
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Please see link below for a video showing the issue.



          I have used your code below to print all State occurences

          if (State >= State.SetDefaults)
          {
          Print("State: " + State);
          Print("toggle: " + toggle);
          }

          Any thoughts please...

          Comment


            #6
            Thank you marty087 for this additional information.


            This behavior was confirmed on our end. We will be investigating this further. Please keep an eye on the NinjaTrader 8 Release Notes page for updates and bugfixes.





            Tracking ID: NTEIGHT-11127

            For reference I am returning a copy of your indicator with a minimal set of code required to reproduce this behavior.
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Hello marty087, I have some feedback from the Development team. Due to a chart's lifecycle, the method we were trying to use to add user controls to a chart is not supported. I am attaching a code sample which demonstrates a supported way of adding user controls to a chart. Please let us know if there are any other ways we can help. This code sample was developed using code found here :

              Attached Files
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Jessica. All working now

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Barry Milan, Today, 10:35 PM
                0 responses
                2 views
                0 likes
                Last Post Barry Milan  
                Started by DJ888, Yesterday, 06:09 PM
                2 responses
                9 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                40 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Today, 08:51 AM
                2 responses
                16 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  
                Working...
                X