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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    593 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X