Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I write indicators from the Trendlines

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

    Can I write indicators from the Trendlines

    Hi,
    I would like to access the Trendlines in the code, so I can write some custom indicator . Can you pls let me know how I can access a Trendline in the code ?

    Thanks

    #2
    Hello,

    Thanks for your forum post.

    Can you please clarify what you mean by TrendLines. To my knowledge NinjaTrader does not include a TrendLines indicator be default. Are you refering to a third party indicator?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      What I mean is : Lets say I draw a line on the Chart, I would like to access this "line" in the indicator code .

      Am I clear ?? I just want to be able to access the objects that I draw such as line, cricle , etc in the indicator code, so I can write code such as, if the price touches my line, then do something...

      Comment


        #4
        Hello,

        Are you using NinjaTrader 7 or NinjaTrader 6.5?

        I look forward to assisting you further.
        BrettNinjaTrader Product Management

        Comment


          #5
          I am using Ninja Trader 7.

          Comment


            #6
            Hello,

            Ok Great.

            With NinjaTrader 7 there is a ILine object.



            That will allow you to access that drawn object so long as you give it a name that your strategy or indicator can pick up on. You will need to check to insure the object exists before running any calculations.

            However the object only contains the start time, start y axis and end y axis and end time.

            It does not contain values between the line to check if price action has based under the line.

            Therefor you will need to calculated this your selve using the start plus end time and axis to determain the price points the line resides on. This requires using MX + B type forumula from geometry to calculate the prices the line would fall through. I will be unable to assist with this however. So this is a little bit more in depth to code then at first glance.
            BrettNinjaTrader Product Management

            Comment


              #7
              This is brilliant. Thanks

              Comment


                #8
                Hey, I checked out what you have mentioned. It says I need to draw the line programatically and then I can access it, which I understand.

                But my problem is - I want to draw the line non programatically using the drawing tools on NT. then I want to access this information in the indicator. ? how can I get the line details ? Is there some function like Line myLine = getLine("mytag");.... something like this which will get me the "mytag" line that I drew.

                Comment


                  #9
                  Hello,

                  When you draw a line and then double left click on it and goto the data tab in the properties for the line will be the tag. You will need to change this tag to be in line with you you code in your indicator. So that the indicator can identify the line and use it. Then you can use LINETAG.StartY for example to get the starting Y value of the line drawn. You will need to name the line with the tag in your code so your code knows which line to access.

                  Let me know if I can be of further assistance.
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    Can you pls give me a code snippet you are referring to ? it will really help.

                    Comment


                      #11
                      Hey!! I found it. DrawObjects gives me the object with the tag.

                      Thanks for your help.

                      Comment


                        #12
                        Hello,

                        Awesome. Yes you can do it this way as well.

                        You can loop through all draw objects on the chart and then access their tags.

                        Let me know if I can be of further assistance.
                        BrettNinjaTrader Product Management

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by argusthome, 03-08-2026, 10:06 AM
                        0 responses
                        77 views
                        0 likes
                        Last Post argusthome  
                        Started by NabilKhattabi, 03-06-2026, 11:18 AM
                        0 responses
                        45 views
                        0 likes
                        Last Post NabilKhattabi  
                        Started by Deep42, 03-06-2026, 12:28 AM
                        0 responses
                        27 views
                        0 likes
                        Last Post Deep42
                        by Deep42
                         
                        Started by TheRealMorford, 03-05-2026, 06:15 PM
                        0 responses
                        32 views
                        0 likes
                        Last Post TheRealMorford  
                        Started by Mindset, 02-28-2026, 06:16 AM
                        0 responses
                        63 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Working...
                        X