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

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.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by llanqui, Today, 03:53 AM
        0 responses
        3 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        10 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        14 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        14 views
        0 likes
        Last Post strategist007  
        Working...
        X