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

How to draw a line from N bar ago but with an angle?

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

    How to draw a line from N bar ago but with an angle?

    Hello
    Please How to draw a line from N barAgo but with an angle?
    the angle is adjustable
    Thanks in advance

    #2
    Hello aekzof,

    Thanks for your post.

    The Draw.Line() method could be used to draw a line from a certain number of barsAgo to the current bar on the chart. The angle of the line drawn would be dependent on the values being passed in for the 'double startY' and 'double endY' arguments when calling the Draw.Line() method.

    The 'double startY' argument would be the value that the line starts drawing at. The 'double endY' argument would be the value that the line drawing ends. The 'int startBarsAgo' argument would determine how many barsAgo the line starts drawing.

    Draw.Line(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush)

    For example, if you set 'startBarsAgo' to 10, the line would start being drawn 10 bars back from the currently forming bar. If you set 'startY' to 1000 and 'endY' to 1005, the line would be drawn at an angle from 1000 to 1005.

    If you want the angle to be adjustable, you could consider using user-defined inputs for the 'startY' and 'endY' arguments.

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

    See this help guide documentation for information about creating user-defined input parameters: https://ninjatrader.com/support/help...d_input_pa.htm

    You could also set up user-defined inputs in the Inputs section of the Inputs and Variables screen of the Strategy Builder. Then, you could click the 'View code' button to see the generated syntax.

    Inputs and Variables screen: https://ninjatrader.com/support/help...ariablesScreen

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      thank you for your reply
      I have already drawn the lines with all these syntax
      but i just had this question in mind
      because I saw this indicator it seems to me that it used angles
      Click image for larger version

Name:	Capture.GIF
Views:	241
Size:	237.1 KB
ID:	1198246
      Attached Files

      Comment


        #4
        Hello aekzof,

        Thanks for your note.

        I am unable to determine which indicator you are referring to in the screenshot you shared. Please answer the following questions so I may accurately assist.

        Is this an indicator or a drawing tool?

        What is the name of the indicator or drawing tool you are referring to?

        I look forward to your reply.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5

          this is a drawing tool not an indicator it was developed i think by your colleague
          but I wonder is it possible to make an indicator like this tools?
          and looking at it I imagined lines with angles
          Best regards

          Comment


            #6
            Hello aekzof,

            Thanks for your note.

            The Gann Fan drawing tool is the only drawing tool that comes default with NinjaTrader that draws an angle on the chart.

            To draw a Gann Fan from a NinjaScript, you could use the Draw.GannFan() method.

            See the help guide documentation below for more information and sample code.

            Draw.GannFan(): https://ninjatrader.com/support/help...aw_gannfan.htm

            Let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ghoul, Today, 06:02 PM
            0 responses
            3 views
            0 likes
            Last Post ghoul
            by ghoul
             
            Started by Barry Milan, Yesterday, 10:35 PM
            6 responses
            18 views
            0 likes
            Last Post Barry Milan  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            13 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            12 views
            0 likes
            Last Post terofs
            by terofs
             
            Working...
            X