• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by forrestang, Today, 07:46 AM
    0 responses
    3 views
    0 likes
    Last Post forrestang  
    Started by rainbow47, Today, 06:10 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChristopherD  
    Started by oscsoft, Yesterday, 07:07 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by pjsmith, Today, 03:28 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Leeroy_Jenkins, Today, 06:54 AM
    0 responses
    4 views
    0 likes
    Last Post Leeroy_Jenkins  
    Working...
    X