Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ZOrder doesn't work

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

    ZOrder doesn't work

    I have 2 indicators with a custom OnRender, but they are rendered in the wrong ZOrder.

    I set the ZOrder like this:
    Code:
    protected override void OnStateChange() {
        // ...
        if (State == State.Historical) {
            SetZOrder(-1);
        }
    }​
    The other indicator uses SetZOrder(0);

    The indicators are drawn in the wrong ZOrder, but when I flip the -1 and 0, nothing changes.
    The ZOrder has no effect.
    What am I doing wrong?

    #2
    Hello Bobin,

    Thanks for your post.

    We are currently researching this inquiry and we will follow up with more information as soon as we are done looking into this inquiry.

    Thanks for your patience; I look forward to assisting further.​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hello Bobin,

      Thanks for your patience.

      Instead of using SetZOrder(-1) and SetZOrder(0) for the indicators, you could use SetZOrder(-1) on one indicator and SetZOrder(1) on the other indicator.

      The indicator set to use SetZOrder(1) would be drawn on top of the indicator set to use SetZOrder(-1).

      See the attached example scripts demonstrating this. SetZOrderTestIndi1 is set to use SetZOrder(-1) and SetZOrderTestIndi2 is set to use SetZOrder(1). When adding the indicators to a chart window, we can see the SetZOrderTestIndi2 magenta line is being drawn over top of the SetZOrderTestIndi1 blue line.

      SetZOrder: https://ninjatrader.com/support/help.../setzorder.htm

      Please let me know if I may assist further.
      Attached Files
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Hello BrandonH,
        thank you very much! It works.
        So I guess we can't use 0 or any negative number other than -1.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X