Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to find distance point-line

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

    how to find distance point-line

    hi, i want to know distance point-line..
    Can somebody help me?...there is a code to do it?
    Attached Files

    #2
    Hello turbofib,

    Thanks for opening the thread.

    I do not have any example code I could share but this is certainly possible to write.

    There are formulas that can be used to determine the distance from a point to a line. The shortest distance will form a perpendicular intercept to the line. You will want to find this line first, and then calculate the distance that line has between the point and where the two lines intersect.

    There is a good publicly available resource for doing the math here: https://www.khanacademy.org/math/geo...int-and-a-line

    I would suggest to look into converting the Price and Time/BarsAgo to pixel coordinates so then you have a common unit for the distance between the point and the line.

    GetXByBarIndex() - https://ninjatrader.com/support/help...bybarindex.htm

    GetYByValue() - https://ninjatrader.com/support/help...etybyvalue.htm

    Other information for working with pixels can be found here: https://ninjatrader.com/support/help...oordinates.htm

    Comment

    Latest Posts

    Collapse

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