Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

when 2nd indicator tries to be assigned to same panel as 1st indicator - it fails

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

    when 2nd indicator tries to be assigned to same panel as 1st indicator - it fails

    I have two indicators. When a user adds the two to the window, I'd like NT(8) to create a new panel and load them both into that panel.

    I know in the UI a user can configure an Indicator to go to one of
    * the same panel as the instrument
    * into a specific already-existing numbered panel
    * into a new panel.

    I feel like the user can't even specify interactively what I'm talking about...

    Is there a way to do that programmatically?

    P.S. the way I've tried doing it looks like tihs:

    -> during State == State.DataLoaded, my 2nd indicator looks through the loaded indicators, finds what panel the 1st indicator was assigned to, and changes its data member "IndicatorBase.Panel" to match that of the first Indicator

    The problem is - this appears to be "too late" - the assignment doesn't immediately change where the 2nd Indicator is placed... until the user hits "F5" - at which point the 2nd indicator disappears from its 2nd panel and reappears where I directed it, to the 1st panel - but then an ugly "empty panel" is left.

    If the user hits "F5" a 2nd time, the ugly "empty panel" disappears.

    So I can do what I want, but at an awful ugly cost - the user has to hit F5, twice!

    Isn't there a better way to do this?

    #2
    Hello dween,

    You can try setting this in configure however specifying a panel directly is not currently supported, you may run into visual problems by doing that.

    Comment


      #3
      To follow up: I've found a method that seems to work, that "tries" harder to work within the framework. Do you see problems with this? (I'm about to post about a problem I'm seeing - it's worthy of its own writeup ).

      My indicator starts out with
      Code:
      Indicator.IsOverlay == true
      , and I expect it to be loaded in the security panel (this is consistent with the NT8 docs as I've read them).

      My indicator has a
      Code:
      Browseable public property
      (bool) that NT8 kindly renders as a checkbox, in the "Indicators > Properties" dialog (Ctrl-I).

      This property is a feature my users can invoke that in effect pops my indicator out of the "security panel" and into a panel of its own.

      Here's the black art I do:
      1. I have a "setter" which gets called very soon after the user clicks to enable the checkbox. I act at that moment, changing the Indicator's
        Code:
        Indicator.IsOverLay
        <- false.
      2. I also immediately change the
        Code:
        Indicator.Panel
        value to
        Code:
        0x7fffffff
        (max positive value).

      The result is that NT8, after closing the "Indicators > Properties" dialog, seeing these changes (which are in between "SetDefaults" and "Configure" states) are respected by the framework, and the framework creates a new Panel for my indicator.

      If the user interactively disables the feature, again in the property setter I undo the process: flip
      Code:
      IsOverlay = true
      and set
      Code:
      Panel = 0
      This much works smoothly.

      I grant you that the
      Code:
      0x7FFFFFFF
      value for
      Code:
      Indicator.Panel
      number is something I saw come up when I interactively specified "display in a new panel" for "Indicators>Properties>Visual>Panel" - I saw that number fly by in diagnostic print statements.

      Am I setting myself up for problems in the future?

      Comment


        #4
        Are you doing this in State.Configure or in a custom class for the property in question?
        Bruce DeVault
        QuantKey Trading Vendor Services
        NinjaTrader Ecosystem Vendor - QuantKey

        Comment


          #5
          Hello dween,

          As mentioned its not a currently supported item so we wouldn't have any details if that may fail in certain use cases. You can try doing that in all of the use cases that you will use the indicator and make sure it works for your purposes. Its normally expected to only use IsOverlay true/false which either makes the indicator attach to the price panel or generate a new panel.

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello dween,

            As mentioned its not a currently supported item so we wouldn't have any details if that may fail in certain use cases. You can try doing that in all of the use cases that you will use the indicator and make sure it works for your purposes. Its normally expected to only use IsOverlay true/false which either makes the indicator attach to the price panel or generate a new panel.
            NinjaTrader_Jesse Thanks for replying. You answered my question (is this supported - what are the consequences).

            I was finding it didn't consistently work for me - the IsOverlay setting didn't seem to "control" whether or not I was in a new panel vs in a separate panel. I found I needed this other setting to get the result I was seeking. .. but see my next post

            Comment


              #7
              Originally posted by QuantKey_Bruce View Post
              Are you doing this in State.Configure or in a custom class for the property in question?
              Neither - I just use a property to wrap the Indicator setting. It's triggered by the setter call, not by OnStateChange:

              Code:
              [Browsable(true)]
              [XmlIgnore]
              public bool IsToDoCoolThing
              {
                  get { return m_isToDoCoolThing; }
                  set { m_isToDoCoolThing = value; AdjustIndicator(); }
              }

              It ends up being in between the call to OnStateChange State.SetDefaults and OnStateChange Set.Configure . Note that the developer has to take into account that the indicator gets created and cloned both coming into the interaction with the settings UI and then cloned again coming out of it. It's documented but I found it helpful to have diagnostic prints to tell me what was going on!
              Last edited by dween; 04-24-2023, 03:03 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X