Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ray anchors - What am I missing

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

    Ray anchors - What am I missing

    Hi,

    I want to detect touches/breaks of a ray line. I thought I could do that with some clever math, but fell at the first hurdle. I can't seem to figure out how to get the Ray anchors. This seems possible from the docs https://ninjatrader.com/support/help...rawingtool.htm

    But, if I try this

    Ray myRay = Draw.Ray(this,"ray1",0,l,i,Low[i],Brushes.White);

    myRay.Anchor does not exist.

    I'm sure I'm doing something silly, but such a simple example and can't figure out what!

    Any clues?

    Thanks.

    #2
    Hello pjsmith,

    Thank you for the post.

    In this case, because the tool has more than one anchor, you would need to specify which anchor you want or loop over the collection of anchors. Here is an example:

    Code:
    if (CurrentBar < 20) return;
    
    Ray myRay = Draw.Ray(this, "ray1", 20, Low[20], 0, Low[0], Brushes.White);
    
    Print(myRay.StartAnchor.Price);
    Print(myRay.EndAnchor.Price);
    // or
    foreach (var chartAnchor in myRay.Anchors)
    {
    	Print(chartAnchor.Price);
    }
    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    77 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    45 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    27 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X