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

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
          TraderGuy
          NinjaTrader Ecosystem Vendor - EMS

          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
              TraderGuy
              NinjaTrader Ecosystem Vendor - EMS

              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 TraderBCL, Today, 04:38 AM
                              1 response
                              5 views
                              0 likes
                              Last Post bltdavid  
                              Started by martin70, 03-24-2023, 04:58 AM
                              14 responses
                              105 views
                              0 likes
                              Last Post martin70  
                              Started by Radano, 06-10-2021, 01:40 AM
                              19 responses
                              606 views
                              0 likes
                              Last Post Radano
                              by Radano
                               
                              Started by KenneGaray, Today, 03:48 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post KenneGaray  
                              Started by thanajo, 05-04-2021, 02:11 AM
                              4 responses
                              471 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Working...
                              X