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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    75 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    43 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    167 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    101 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    165 views
    2 likes
    Last Post CaptainJack  
    Working...
    X