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:	178
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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X