Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

isGlobal draws on top of Bars instead of behind

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

    isGlobal draws on top of Bars instead of behind

    I can't get rectangles to draw behind the bars when using isGlobal. I've tried using different templates.
    SetZOrder is declared as -1 according to sample from the documentation.

    Code:
       
    // Make sure our object plots behind the chart bars
     SetZOrder(-1);​
    For the below picture I use:

    Code:
    NinjaTrader.NinjaScript.DrawingTools.Rectangle myBox = Draw.Rectangle(
                        this,                 //Owner
                        recName + index,      //Tag
                        barsAgoTime,          //dateTime date
                        High.GetValueAt(index),       //double
                        endBarsTime,                //dateTime date
                        Low.GetValueAt(index),       //double
                        ShowGlobalLines,            //Show on global charts
                        "recTemplate"              //Templatename
                    );
                    myBox.AreaBrush = lineBrush;
                    myBox.AreaOpacity = opacity;​

    Click image for larger version

Name:	notGlobal.png
Views:	175
Size:	34.8 KB
ID:	1224503























    Then I change the parameter ShowGlobalLines to true and all rectangles are drawn on top of the bars instead.
    I can't figure out what I'm missing here. Are isGlobal objects always drawn on top?


    #2
    Hello Borgen,

    The drawing object at that point will have it's own ZOrder.

    Use DrawingToolZOrder.AlwaysDrawnFirst to ensure it is under the bars.


    Code:
    NinjaTrader.NinjaScript.DrawingTools.Line line1 = Draw.Line(this, "line1", true, 30, Close[0] + 2 * TickSize, 0, Close[0] - 2 * TickSize, true, string.Empty);
    line1.ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;
    Last edited by NinjaTrader_ChelseaB; 11-21-2022, 10:58 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Awesome, thank you! This solved it for me!

      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