Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 frslvr, 04-11-2024, 07:26 AM
          8 responses
          111 views
          1 like
          Last Post NinjaTrader_BrandonH  
          Started by stafe, 04-15-2024, 08:34 PM
          10 responses
          44 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by rocketman7, Today, 09:41 AM
          3 responses
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by traderqz, Today, 09:44 AM
          2 responses
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by rocketman7, Today, 02:12 AM
          7 responses
          31 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X