Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Guys need some help-Trend Line in strategy

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

    Guys need some help-Trend Line in strategy

    I am trying to figure out how I could build a trend line into my rule where if its broken my position will enter or exit depending on current position. Does someone have a way that they build automatic trend lines where its touching just the lowest low and the highest low and vice versa, and ignore the data in between. Drawing it by hand is easy on a chart, but I'm trying to figure out how I could actually have this coded for either a fixed number of bars, where it re checks the slope, or an adaptive level of number of bars based on it extending itself. Any input is greatly appreciated about how I could do this.

    #2
    JSeymour,

    You would need to determine what kind of logic you want to use to draw it. Then you can use DrawLine() to programmatically draw it, but this is not programmatically accessible. You will have to do math yourself to determine slope and things like that in your code.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      reply

      Josh, what do you mean by programmatically accessible...do you mean although it may be able to DrawLine, I can't have it use that as a fixed value to then check it for say closing above or below that ?

      Comment


        #4
        What I mean by it is that you can for sure draw the line at whatever points you want, but after you draw the line you can't, for instance, access the value of the line at any particular point on the line.

        The only values at your disposal would be the beginning and ending points of the line.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          What I mean by it is that you can for sure draw the line at whatever points you want, but after you draw the line you can't, for instance, access the value of the line at any particular point on the line.
          Will we have programmatic access to a line in NT 7?

          Regards,
          TG

          Comment


            #6
            "Draw Objects Enhancements
            Draw objects are now associated to an indicator which means that if a user removes a draw object from the chart, it will also remove the indicator. In addition, all draw objects spawned from an indicator share the indicator's z-order.


            IDrawObject - IDrawObjects are now returned to the caller on all Draw() methods. IDrawObjects expose draw objects properties.

            Work in progress - We will implement programmatic access to draw objects added to a chart manually. For example, you can have a user draw a line on a chart and add a "tag" to this object and you can retrieve this object, read it's value and do something with it."



            http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html Hope that helps.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It does, thanks.

              TG

              Comment


                #8
                Hey Josh,

                Has programmatic access to draw objects been implemented in NT7 yet?

                Thanks
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  mrlogik, yes this is available in NT7 (IDrawObject).
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Bertrand,

                    Thanks for the reply.

                    In looking through the IDrawObject attributes, I don't see anything that will return a current draw objects price, or y-axis position. How would I access a horizontal lines price value?

                    Thanks
                    mrlogik
                    NinjaTrader Ecosystem Vendor - Purelogik Trading

                    Comment


                      #11
                      For horizontal lines you would use IHorizontalLine. Please see the Help Guide article for IHorizontalLine to see an example.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Perfect!

                        Thanks
                        mrlogik
                        NinjaTrader Ecosystem Vendor - Purelogik Trading

                        Comment


                          #13
                          getting properties of objects manually drawn on a chart?

                          Could you please give an example of how to programatically access the properties of a user drawn object that was added to the chart manually, as mentioned by Josh in Post #6 of this thread?

                          Thank you.
                          Last edited by Ricam; 03-08-2010, 05:08 PM.

                          Comment


                            #14
                            IHorizontal horizontalLine = DrawHorizontalLine(....);
                            Print(horizontalLine.Y);
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Properties of a manually drawn object

                              In the previous example, the line seems to have been drawn programatically, not manually.
                              Is there a way to programatically iterate through the manually drawn objects that actually exist on a chart, to obtain their properties?

                              Thanks.
                              Last edited by ZTR; 03-08-2010, 05:37 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Lando Calrissian, Today, 07:30 AM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by lismartin, Yesterday, 04:47 PM
                              1 response
                              15 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by facuevasm, Today, 07:28 AM
                              2 responses
                              7 views
                              0 likes
                              Last Post facuevasm  
                              Started by ballston, Today, 06:32 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post ballston  
                              Started by Leeroy_Jenkins, Today, 03:45 AM
                              0 responses
                              13 views
                              0 likes
                              Last Post Leeroy_Jenkins  
                              Working...
                              X