Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawn rectangle gets overwritten

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

    Drawn rectangle gets overwritten

    Hi,

    I've been drawing a box at the bottom of my charts to display a few stats. I painted (in onrender) a black rectangle, then the text over that. This all works fine, but some of the other drawing objects, show through. I guess they are drawn after I drew the rectangle. I tried changing the order of the indicators, but it did not make a difference. Some of the other indicators lines still show through.

    Is there a way to avoid this? it seems the majority of stuff hidden, but some things like horizontal lines and the emas show right through.

    My rectangle is drawn and filled as follows

    RenderTarget.DrawRectangle(rect, customDXBrush, 2);
    RenderTarget.FillRectangle( rect, customDXBrushBackground);


    Thanks,

    #2
    Hello pjsmith,

    In OnRender() things will be layered on top of each other as they are drawn.

    Render the things you want on the bottom first.

    For your renderings to be on top of drawing objects that are drawn by the same indicator, call base.OnRender() at the bottom of OnRender().

    For drawing objects that are not drawn by this same script, adjust the z-order of your indicator or the drawing objects individually.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for that. The objects are from other indicators and manually drawn. I thought about z-order, but the issue is, my lines are very dynami (a lot fo the lines are manually drawn)c. I draw maybe 30-50 of them a day. To change the z-order on all manually...... Somthing I would rather avoid. Is there a way to set the z-order of the rectangle to be on top of everything else programatically? (because I cannot do that manually as it cannot be selected?)

      Thanks.

      Comment


        #4
        Hello pjsmith,

        Each indicator will have it's own z-order. Each manually drawn object will have it's own z-order.

        You will need to manually adjust these as you see fit.

        For a drawn object to automatically bring it self to the relative top, you can set the ZOrderType to DrawingToolZOrder.AlwaysDrawnLast in State.Configure.
        https://ninjatrader.com/support/help...zordertype.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello pjsmith,

          For a drawn object to automatically bring it self to the relative top, you can set the ZOrderType to DrawingToolZOrder.AlwaysDrawnLast in State.Configure.
          https://ninjatrader.com/support/help...zordertype.htm
          Thank you. That sounds like a solution.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X