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

Ending DrawExtendedLine

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

    Ending DrawExtendedLine

    I want to draw a horizontal line. I know the starting point, but I don't know the end point until a certain criteria happens sometime in the future. Can I use DrawExtendedLine and somehow "end" it when my criteria happens, or do I need to use DrawLine and keep removing it and re-drawing it for each bar, until my criteria happens ? (which would take much more processing than necessary). I'm using version 7.

    Thanks

    #2
    trader416,

    You would need to create two conditions where both are using the same DrawExtendedLine tag, but the end values will change where the condition is true or not true.

    So for example, when the condition is not true, you would use the current bar and price values for the draw object, but when the condition is true you would set the exact X and Y value you intend to use for this object.

    Please let me know if you need further clarification.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks. That makes sense.
      However, I keep getting a compile error with Extended lines. When I use DrawLine, it's fine, but my extended line always gets a CS1501 error. I'm using Version 7, and here's the code I'm using:

      DrawExtendedLine("RHline", 1, RangeH, 0, RangeH, Color.Blue, DashStyle.Solid, 1);

      Any ideas what's wrong ?
      Thanks.

      Comment


        #4
        trader416, what is the exact text for the CS1501 error?
        AustinNinjaTrader Customer Service

        Comment


          #5
          It says:
          No overload for method 'DrawExtendedLine' takes '8' arguments

          Comment


            #6
            trader416,

            You'll have to use one of the supported overloads for this. Intellisense can help build this. Type DrawExtendedLine( You'll see one overload available, and can toggle among them using your arrow up and down keys.

            They're also available here:
            Last edited by NinjaTrader_RyanM1; 07-17-2011, 06:47 PM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              What is the difference between DrawLine and DrawExtendedLine? They look the same to me.

              Comment


                #8
                A line has a definite start and end: Point A > Point B. Extended lines "extend" in both directions. They're both available to draw manually on chart as well - easiest way to see the difference.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Think you can do the same with DrawLine using CurrentBar....

                  Comment


                    #10
                    Originally posted by NinjaTrader_RyanM View Post
                    trader416,

                    You'll have to use one of the supported overloads for this. Intellisense can help build this. Type DrawExtendedLine( You'll see one overload available, and can toggle among them using your arrow up and down keys.

                    They're also available here:
                    http://www.ninjatrader.com/support/h...tendedline.htm
                    Ryan_M,
                    I don't understand. I thought I had done that. I posted the line of code in a previous post. I followed the IntelliSense, and checked it against code that others have written for DrawExtendedLine, but I still get this error. I have 8 arguments.

                    Comment


                      #11
                      Originally posted by trader416 View Post
                      but I still get this error. I have 8 arguments.
                      Exactly. The message is "No overload... takes '8' arguments".

                      One way to see the overloads available is with intellisense. The other is with the documentation. I've pasted below the three potential overloads expected and the example from the documentation.

                      Code:
                      DrawExtendedLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color) 
                      
                      DrawExtendedLine(string tag, bool autoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color, DashStyle dashStyle, int width)
                      
                      DrawExtendedLine(string tag, bool autoScale, DateTime startTime, double startY, DateTime endTime, double endY, Color color, DashStyle dashStyle, int width)
                      
                      DrawExtendedLine("tag1", false, 10, Close[10], 0, Close[0], Color.LimeGreen, DashStyle.Dot, 2);
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks. If I knew how to count to 9, I would have caught this (how embarrasing). Thanks again.

                        Comment


                          #13
                          Glad you got it sorted. Thanks for letting us know.
                          Ryan M.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Javierw.ok, Today, 04:12 PM
                          0 responses
                          4 views
                          0 likes
                          Last Post Javierw.ok  
                          Started by timmbbo, Today, 08:59 AM
                          2 responses
                          10 views
                          0 likes
                          Last Post bltdavid  
                          Started by alifarahani, Today, 09:40 AM
                          6 responses
                          40 views
                          0 likes
                          Last Post alifarahani  
                          Started by Waxavi, Today, 02:10 AM
                          1 response
                          18 views
                          0 likes
                          Last Post NinjaTrader_LuisH  
                          Started by Kaledus, Today, 01:29 PM
                          5 responses
                          15 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Working...
                          X