Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Iterate through user drawn vertical lines and get their properties

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

    How to Iterate through user drawn vertical lines and get their properties

    What's the syntax for iterating through the user drawn vertical lines on a chart to print the tags, and horizontal locations. of all of those lines?
    Have been able to get the tags, but not the locations, either as date times or bar numbers.
    Thanks in advance.

    #2
    Hello Ricam,

    Thanks for your post.

    For an example, please see the help guide here: https://ninjatrader.com/support/help...rawobjects.htm

    The 2nd example provides a clue on how to access the anchor points.

    I don't have an example for vertical lines but perhaps this one for rectangles will help:

    Code:
     if (DrawObjects.Count > 0)
    {
    foreach (DrawingTool draw in DrawObjects.ToList())
    {
    if (draw is DrawingTools.Rectangle )
    {
    Print ("Tag name: "+draw.Tag);
    DrawingTools.Rectangle temp = draw as DrawingTools.Rectangle;
    
    Print("startYPrice: " + temp.StartAnchor.Price);
    Print("startXTime: " + temp.StartAnchor.Time);
    Print("startXBarsAgo: " + (CurrentBar - temp.StartAnchor.SlotIndex));
    Print("endYPrice: " + temp.EndAnchor.Price);
    Print("endXTime: " + temp.EndAnchor.Time);
    Print("endXbarsago: " + (CurrentBar - temp.EndAnchor.SlotIndex));
    }
    }
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    58 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    35 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    59 views
    0 likes
    Last Post PaulMohn  
    Working...
    X