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

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 wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          191 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,230 views
          0 likes
          Last Post xiinteractive  
          Working...
          X