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 CarlTrading, Yesterday, 11:51 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, Yesterday, 11:48 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-25-2026, 09:53 PM
    0 responses
    30 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 03-25-2026, 09:51 PM
    0 responses
    18 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 03-23-2026, 11:13 AM
    0 responses
    24 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X