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.

    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.

        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.

            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.

                  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.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by itrader46, Today, 09:04 AM
                        1 response
                        3 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by timmbbo, Today, 08:59 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post timmbbo
                        by timmbbo
                         
                        Started by bmartz, 03-12-2024, 06:12 AM
                        5 responses
                        33 views
                        0 likes
                        Last Post NinjaTrader_Zachary  
                        Started by Aviram Y, Today, 05:29 AM
                        4 responses
                        14 views
                        0 likes
                        Last Post Aviram Y  
                        Started by algospoke, 04-17-2024, 06:40 PM
                        3 responses
                        28 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X