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

flipping trendlines

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

    flipping trendlines

    Hello

    I want to flip a horizontal trendline to a vertical trendline. Baslically change the slope of the trendline from 0 to 90 degrees up or down. Any ideas on how i can do this in ninjascript?

    #2
    Hello russ123,

    Thank you for your post.

    Please answer the following questions so we may be of further assistance.

    Comment


      #3
      hello,

      I am using the drawlinefunction within ninjascript which basically takes the X1 X2 and the Y1 Y2 coordinates. I am specifying the X1 Y1 and X2 Y2 coordinates to draw a horizontal trendline.

      Now I need to create a VERTICAL trendline of the same length. The X1 and X2 coordinates are the same and they are known because I specified them for the horizontal trendline. The Y1 coordinate is also known. The problem is the Y2 coordinate for the vertical trendline. The Y2 coordinate is the distance/length of the horizontal line, which is (X2-X1). How can i get this distance and plot it on the Y axis to create a vertical trendline ?

      There maybe another way to do it if there is a method that accepts Slope. If I can specify a slope of 90 degreess for a horizontal trendline, then that line would become a vertical line. I am not sure if there is something like this available ?

      thank you,
      Rassul

      Comment


        #4
        Hello Rassul,

        Thank you for your response.

        I would store the difference of the X1 and X2 in a double and then use it for the Y2 when switching to the vertical line.

        Comment


          #5
          hello Patrick,

          I dont think it can be done like this because x2 - x1 will give the number of bars across the x axis,not the actual distance in cm or inches.

          for example, If the number of bars is 10 and i substitute this for the Y2 parameter, it will not work because adding 10 to a contract like the yen or the euro will be way too much. Even if i multiply it by the tick size, it will be inaccurate.

          The only way to do this is by capturing the distance/length in cm or inches and then using that distance/length to get Y2.

          other ideas that come to mind are
          1) changing the slope to 90 degrees
          2) see if it Is possible to draw a big square instead by just giving the parameters for the length of the square. One side is all you need for a square. Maybe there is a method to do this ?

          let me know if you have any more input

          Comment


            #6
            Hello russ123,

            Thank you for your response.

            If it needs to be exact to the distance as viewed on the chart I would move to custom plotting via overriding the Plot() method. We have an example under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NTnoon, Today, 03:43 AM
            0 responses
            3 views
            0 likes
            Last Post NTnoon
            by NTnoon
             
            Started by greenworkhe, Today, 03:23 AM
            0 responses
            7 views
            0 likes
            Last Post greenworkhe  
            Started by ireqoweewes, Today, 03:17 AM
            0 responses
            11 views
            0 likes
            Last Post ireqoweewes  
            Started by buytrueketo, Today, 02:14 AM
            0 responses
            11 views
            0 likes
            Last Post buytrueketo  
            Started by buytrueketo, Today, 02:13 AM
            0 responses
            12 views
            0 likes
            Last Post buytrueketo  
            Working...
            X