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

Change Panel according to inputs

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

    Change Panel according to inputs

    In indicator options I want to have a checkbox named "myShowInNewPanel".
    I want, if i check that, then indicator was shown in new panel, if i uncheck, in the same price-panel.
    However, that seems not trivial.
    I've tried this :
    Code:
    //setdefaults ->  myShowInNewPanel=false;
    
    
    if (State == State.Configure)
    {
                    if (myShowInNewPanel)
                    {
                        IsOverlay = false;
                        Panel = 0;
                    }
    }
    however, if while adding indi on chart, i will check that checkbox (&apply) then it shows in new panel, but if then again i uncheck & apply, then the second panel remains there.
    that is the problem at this moment.
    Last edited by ttodua; 11-19-2019, 09:17 AM.

    #2
    Hello TazoTodua,

    Thanks for your question.

    As I see we can correctly set IsOverlay in State.Configure, however, once a panel is added is added, NinjaTrader is not removing the existing panel when IsOverlay is set back to true.

    I am inquiring with our Product Management team to see if this is an expected limitation and we should request an improvement to this functionality, or if this is a bug by design specs.

    I'll update this post when I have further details.
    JimNinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Jim I observe the strange behavior. this might be bug or i dont know. here details to reproduce...
      using the same above code, just add a test "AddPlot",
      and in OBU (onbarupdate) just put:
      Values[0][0]=123;

      then:

      - When adding indicator, check the mentioned checkbox;
      - then click F5 on chart - you will see the indicator panel will still there, but empties (no plotlines will show)
      - click F5 again - you will see the panel moved to the main chart, and the plot still shows.


      I think this is not intended behavior. as i said, we should be able to have any mechanism to control where we want to show the new panel. I suspect NinjaTrader_Jesse might have any clue about this problem.

      Comment


        #4
        Originally posted by ttodua View Post
        In indicator options I want to have a checkbox named "myShowInNewPanel".
        I want, if i check that, then indicator was shown in new panel, if i uncheck, in the same price-panel.
        However, that seems not trivial.
        I've tried this :
        Code:
        //setdefaults -> myShowInNewPanel=false;
        
        
        if (State == State.Configure)
        {
        if (myShowInNewPanel):confused:
        {
        IsOverlay = false;
        Panel = 0;
        }
        }
        however, if while adding indi on chart, i will check that checkbox (&apply) then it shows in new panel, but if then again i uncheck & apply, then the second panel remains there.
        that is the problem at this moment.
        You probably want to do that in State.SetDefaults, and then you want to explicitly set the Panel to use. Query the indicators on the chart to determine which is the last panel used.

        However, to do all that, you are going to have to open the PropertyGrid anyway, so why not just use the already provided means to change the display Panel?

        Comment


          #5
          Koganam, thanks for stepping in. unfortunately, i fear that I dont quite understand (because I dont have any examples) of what you described.. setting in statedefaults is before user-interaction to inputs, so i cant understand well (maybe you can give a sample code of what you mean), i want that USER checked the checkbox, and depending on the checked-value of that checkbox do the action, so, i cant think of any value of statedefaults.

          about PropertyGrid - you means Property grid collection, to alter the Panel property according to user action?

          Comment


            #6
            Originally posted by ttodua View Post
            Koganam, thanks for stepping in. unfortunately, i fear that I dont quite understand (because I dont have any examples) of what you described.. setting in statedefaults is before user-interaction to inputs, so i cant understand well (maybe you can give a sample code of what you mean), i want that USER checked the checkbox, and depending on the checked-value of that checkbox do the action, so, i cant think of any value of statedefaults.

            about PropertyGrid - you means Property grid collection, to alter the Panel property according to user action?
            What you are describing means that you will have to open the PropertyGrid anyway, so why not use what already is provided? What does your scheme gain you over just using what is already there? That is why I am confused.

            Click image for larger version  Name:	NT8-selectpanel.png Views:	0 Size:	61.6 KB ID:	1078774

            Comment


              #7
              Koganam,
              I have not fully described the case in question, but depending on options (checkboxes) the Panel should be automatically chosen without user needing to explicitly select the Panel dropdown.
              that's why i wanted that.
              i.e. if user checks "Show My Histogram" or "Show relative line" then the new panel should be chosen automatically, otherwise - same panel.

              Comment


                #8
                Originally posted by ttodua View Post
                Koganam,
                I have not fully described the case in question, but depending on options (checkboxes) the Panel should be automatically chosen without user needing to explicitly select the Panel dropdown.
                that's why i wanted that.
                i.e. if user checks "Show My Histogram" or "Show relative line" then the new panel should be chosen automatically, otherwise - same panel.
                Well, it is just me, but I do not see what you gain, as to use your checkbox, you will still have to open the PropertyGrid anyway, so again, why not just use what is already there. However, if you insist on what you want to do, then you will have to take care of all the underlying plumbing.

                You need to know which panel your indicator is on, or will be placed onto.
                ref: https://ninjatrader.com/support/help...chartpanel.htm
                https://ninjatrader.com/support/helpGuides/nt8/panelindex.htm?zoom_highlightsub=panel


                If the panel layout is to be preserved across NT running sessions, then you will need to store/restore the layout, so you need to serialize your panel layout for restoration.

                Then you need to write the actual code that will move your objects. The NT manual has some code for moving objects from a panel to another. ref: https://ninjatrader.com/support/help...r_an_addon.htm

                That would be the barest minimum to handle. There are probably other niceties to handle as well. Somehow, I do not think that avoiding ONE more mouse click is worth the coding effort, but again, that is just me.

                All the best.
                Last edited by koganam; 11-24-2019, 08:43 AM.

                Comment


                  #9
                  ouh, excellent answer! now i think i fully agree with you.. (however, god to know those all details too for any case).

                  if i will still need what i wanted, i will just change the input value of Panel field by changing the other checkbox (by RefreshProperties route if i correctly remember is easier, 15 lines of code to handle property change detection handler and change other property depending on that).

                  Comment


                    #10
                    Hello TazoTodua,

                    The Development team has reviewed the behavior with IsOverlay further. Additional panels are added in State.SetDefaults. While there has been some ability to set IsOverlay in State.Configure, it is not fully functional and thus not fully supported. The Help Guide will be updated to reflect that IsOverlay should only be set in State.SetDefaults.

                    Please let us know if you have any questions.
                    JimNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Yesterday, 06:40 PM
                    2 responses
                    20 views
                    0 likes
                    Last Post algospoke  
                    Started by ghoul, Today, 06:02 PM
                    3 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    45 views
                    0 likes
                    Last Post jeronymite  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    7 responses
                    21 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    10 responses
                    181 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X