Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.HorizontalLine Customizable Length?

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

    Draw.HorizontalLine Customizable Length?

    Is it possible to use the Draw.HorizontalLine function and be able to customize the length of the horizontal line plotted? If the start of the horizontal line is above the current price, then could the length be customized by % of chart or number of candles to the left?

    #2
    I think the Draw.Line command is the tool you need for what you're searching for, to my understanding of your description:

    https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?language_reference_w ip.htm

    The Draw.Line command has a Start Time and End Time (or startBarsAgo / endBarsAgo) that can be settled, in the diferent versions of this command.

    I suggest you have a look at it.

    Comment


      #3
      Ya I have tried using Draw.Line extensively, but it will never work the way I need it to. I just want a horizontal line that moves as the current price moves and any attempt with Draw.Line no line is ploted, but I can get Draw.Horizontalline to plot, but i cannot customize the length of it.

      Comment


        #4
        Hello notatrader11,

        Thanks for your post and welcome to the NinjaTrader Forums!

        The Draw.HorizontalLine() method does not have an argument that allows you to specify the length of the line.

        To draw a line on the chart from one point to another point you would need to use the Draw.Line() method as Bricolico has noted.

        Note that if you are trying to modify a line drawn on the chart, you could pass in the same Tag name when calling Draw.Line().

        From the help guide:

        " tag - A user defined unique id used to reference the draw object.

        For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."


        ​See this help guide documentation for more information about the Draw.Line() method and sample code: https://ninjatrader.com/support/help.../draw_line.htm

        Note that if code in your script is not working as expected, such as drawing an object or not drawing an object, it is necessary to add debugging prints to the script that print out all the values being used in the condition to draw the line (one line above the condition) and prints out the values you are passing into the Draw method. Also, keep an eye on the Log tab of the Control Center for any error messages that may appear.

        Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121
        Last edited by NinjaTrader_BrandonH; 01-21-2024, 02:51 PM.
        <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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        597 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 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
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        555 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X