Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overlapping DrawLines

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

    Overlapping DrawLines

    I have 2 DrawLines and sometimes a section of both lines overlaps, which is ok. However, I would like Line B to always overlap Line A in this situation. It seems that as the price fluctuates, sometimes Line A is overlapping Line B, sometimes Line B is overlapping Line A. Seems to change back and forth randomly.

    You can run a simple test:

    DrawLine("test1", true, 2, High[0], 0, Low[0], Color.Red, DashStyle.Solid, 3);
    DrawLine("test2", true, 2, High[0], 0, Low[0], Color.Blue, DashStyle.Solid, 3);

    Sometimes the line is red, sometimes it is blue. Shouldn't it always be blue, since that is the second line being drawn? That is what I want, but that is not what is happening. How can I make it so the above code always renders a blue line? Or, what should I add to the code to make it so the line is always blue in this case?

    #2
    Hello mfortnow,

    Thank you for your post.

    Unfortunately, there is no method to set the Z-Order which is effecting the drawing objects over lapping each other. This can be manually set but is not something that can be set in the NinjaScript code.

    Comment


      #3
      Thanks Patrick. Is there any logic in this situation as to when the line is red or blue, or is it just random?

      Comment


        #4
        Hello mfortnow,

        Thank you for your response.

        It seems this is random for the drawing objects that are drawn at the same time.

        Comment


          #5
          Originally posted by mfortnow View Post
          I have 2 DrawLines and sometimes a section of both lines overlaps, which is ok. However, I would like Line B to always overlap Line A in this situation. It seems that as the price fluctuates, sometimes Line A is overlapping Line B, sometimes Line B is overlapping Line A. Seems to change back and forth randomly.

          You can run a simple test:

          DrawLine("test1", true, 2, High[0], 0, Low[0], Color.Red, DashStyle.Solid, 3);
          DrawLine("test2", true, 2, High[0], 0, Low[0], Color.Blue, DashStyle.Solid, 3);

          Sometimes the line is red, sometimes it is blue. Shouldn't it always be blue, since that is the second line being drawn? That is what I want, but that is not what is happening. How can I make it so the above code always renders a blue line? Or, what should I add to the code to make it so the line is always blue in this case?
          Custom Plot() using DrawPaths ?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          131 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          74 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          117 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          111 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          89 views
          0 likes
          Last Post CarlTrading  
          Working...
          X