Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Triangles and angles

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

    Triangles and angles

    Hi

    Is there any way when creating a triangle from 3 points, overlayed on a chart, that I would be able to calculate the internal angles?

    I can initially think to use the number of bars (x axis) and price (y axis) but obviously these values are not related in any way to each other and therefore any angle produced would not necessarily be accurate.

    Would I be able to get at he length of the lines in pixels or any form of measurement scale?

    Any thoughts appreciated.
    Thanks

    #2
    Hello fishbed,

    Thanks for opening the thread.

    You could use some trigonometry to calculate the angle based off of the slope of each line. You could calculate the slope using the drawing objects anchors. I can think of a couple implications while considering this.

    Using Price levels and bar indexes would keep the slope consistent in a price vs bar index perspective, but would not reveal a true angle in the charts scale.

    Using the pixel coordinates from the anchors to calculate slope will give you a truer angle in relativity to the chart, but the chart's auto scale setting should be noticed when calculating the slope from these anchors. If the charts scale changes, so will the angles. I would advise to override OnCalculateMinMax() and recalculate your slopes there to maintain accurate angles.

    ChartAnchor.GetPoint() - https://ninjatrader.com/support/help...s/getpoint.htm

    DrawObjects (to be referenced for looping through DrawObjects) - https://ninjatrader.com/support/help...rawobjects.htm

    OnCalculateMinMax() - https://ninjatrader.com/support/help...lateminmax.htm

    You can use an inverse tangent to calculate the angle from slope.

    Formulas for calculating the slope of lines or surfaces, plus tables of common slopes used in architecture.




    Please let me know if I may be of further assistance.

    Comment


      #3
      triangle angles

      HI Jim

      Thanks for this, it is given me a lot to ponder and look through.

      Regards

      Comment


        #4
        Rather than Bars or Pixels why not use Price(y) and Time(x) given NT8 has
        better time resolution than NT7.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        650 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        577 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X