Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.VerticalLine on 10th bar to the right (updates every bar)

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

    Draw.VerticalLine on 10th bar to the right (updates every bar)

    Hello, Can you help me with a code that draws vertical line on the 10th bar to the right (barsAgo = 9), and updates every bar, that means, that on each OnBarUpdate, previous vertical line is deleted and new line is drawn.

    #2
    Hello UltraNix,

    Thanks for your post.

    You could use Draw.VerticalLine() to draw a vertical line on the chart at a specified bar.

    See the sample code in the help guide documentation linked below which demonstrates drawing a vertical line using a barsAgo value of 10.

    Draw.VerticalLine(): https://ninjatrader.com/support/help...rticalline.htm

    If you would like to use a barsAgo value of 9, you would simply set that for your barsAgo argument when calling the Draw.VerticalLine() method.

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      It draws over chart candles. Is there a way to draw a line "under" (I mean that candles are in foreground, and line is in the background)?

      Comment


        #4
        Hello UltraNIX,

        Thanks for your note.

        You could use SetZOrder() to determine the index in which chart objects are drawn on the chart's Z-axis (front to back ordering). Objects with a higher ZOrder are drawn first.

        See the attached example script demonstrating this.

        And, see this help guide page for more information about SetZOrder(): https://ninjatrader.com/support/help.../setzorder.htm

        Let us know if we may assist further.
        Attached Files
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Thanks, NinjaTrader_BrandonH your help was spot on!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          563 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          329 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          547 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          548 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X