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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        49 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        69 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        36 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        96 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        59 views
        0 likes
        Last Post PaulMohn  
        Working...
        X